The default is GET, however, if you pass the 2nd parameter as URL data
and not a function, then jQuery assumes a POST is desired. Studying
this seems odd. I can take a swag at the reasons:
- As a "poor's man" security consideration against ajax
injections. and
- If you are sending JSON data, its cleaner to send non name=value
pair data as a post.
But seeing how it works, seems odd. It depends greatly on what you
want to send. Are you sending JSON data? Or did really just want to
send a name=value pair?
For example, this will use the GET instead:
$('#tags').load('/data/tags?format=xhtml');
or you could use the .get method instead with the JSON data:
$.get('/data/tags', {format: 'xhtml'}, function(data) { $
('#tags').innerHTML = data; });
But what I found very odd is this:
$('#tags').load('/data/tags","format=xhtml");
What I am seeing at the server is the POSTed data coming in as (and
Firebug shows it being as sent too):
0=f&1=o&2=r&3=m&4=a&5=t&6=%3D&7=x&8=h&9=t&10=m&11=l
Why is it doing that? Very odd logic!
--
HLS
On Aug 18, 4:35 pm, angelogladding <[EMAIL PROTECTED]> wrote:
> When I attempt to load into a ul (#tags) jQuery seems to be sending a `POST`
> request. Both my backend framework and Firebug seem to agree. Nowhere in the
> documentation does it specifically state whether it sends a GET or POST. Can
> anyone clarify?
>
> My code follows:
>
> $('#tags').load('/data/tags', {format: 'xhtml'});
>
> Thanks,
> Angelo
> --
> View this message in
> context:http://www.nabble.com/%24.load%28%29-POSTing-instead-of-GETing-tf4291...
> Sent from the JQuery mailing list archive at Nabble.com.