Just curious, what changes about the server's behavior when the x-Method is 
specified as Ajax?

----- Original Message ----
From: Diego A. <[EMAIL PROTECTED]>
To: jquery-en@googlegroups.com
Sent: Friday, April 6, 2007 5:48:20 PM
Subject: [jQuery] Re: Unique parameter in Ajax



Thanks for the quick response guys. This message had been pending for a few
days and I've since managed to work around the problem, but I think this
might be a bug.

By doing this...
$.ajaxSetup({ global:true, data:{'ajax':'y'} });
... jQuery should:
1. add 'ajax = y' to the data submitted when I call $.post
2. add 'ajax=y' to the querystring when I call $.get
but it doesn't! I think this is a bug.

I tried to work around using the beforeSend parameter like this...
$.ajaxSetup({ global:true, beforeSend:function(r,o){ /* ADD ajax=y TO CALL
*/ } });
... but this doesn't work because the transport (request object) is already
open by then and url/query string has already been defined and is readOnly.

I can't use the ajaxStart global event because I can't access the individual
call's settings.
I can't use the ajaxSend global event because as beforeSend, the transport
(request object) is already open and by this point the url/query string has
already been defined and is readOnly.

I ended up changing my server application to look for the header "x-Method =
Ajax" and it works just fine.


malsup wrote:
> 
> Ariel and Jörn posted some good ideas on this thread:
> 
> http://groups.google.com/group/jquery-en/browse_thread/thread/5ec973dd2ca45738/3794cc7ced0f3ee0#3794cc7ced0f3ee0
> 
> 
>> I'd like to add a unique parameter to every ajax call jquery makes.
>> I need this to happen on get and post commands (ie.: form submits too).
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Unique-parameter-in-Ajax-tf3440508s15494.html#a9880250
Sent from the JQuery mailing list archive at Nabble.com.




Reply via email to