PDA

View Full Version : UpdateManager.update. Choosing HTTP method (revisited)



Animal
23 Feb 2007, 7:01 AM
The code in the latest download contains



var method = params ? "POST" : "GET";


I thought I rememebered seeing a thread in which someone discussed this.

We talked about deciding based upon the length of the URL, and you decided to use an optional parameter setting, but have the default being GET since it's not formUpdate, and we are getting data, rather than posting a form:



var method = cfg.method || "GET";

jack.slocum
23 Feb 2007, 7:09 AM
Can I ask why you prefer GET to POST? Post avoids caching issues. Changing at this point is not a good idea because everyone's stuff will start caching in IE and breaking and they will wonder why.

Animal
23 Feb 2007, 7:24 AM
It doesn't really matter. It's just that all I'm doing is getting a JSP page. It would be got with a GET request if I wasn't using an UpdateManager, but was using the old page->page navigation method.

I seem to remember that the poster on that other thread did want some control over the method. There's some obscure technical reason to use the "correct" method I think.

jack.slocum
23 Feb 2007, 7:29 AM
It's an option. It can be set on the UpdateManager prototype (method) and in the load config:


el.load({
url: 'foo.php', method: 'GET'
});

By default, it won't change.

Animal
23 Feb 2007, 8:54 AM
Am I being really dense here? (It is nearly home time after all, and I've been here since 7am) :D

I just see the line



var method = params ? "POST" : "GET";


No usage of a method property from the cfg object!

jack.slocum
23 Feb 2007, 2:10 PM
I was saying that I had just added it as requested. :)