Exactly. That is exactly why I needed that unique parameter.
And to answer the question of 'how' I do it, here's the code (ASP):

DIM AJAX_REQUEST = False
' Look for "x-Requested-With" header sent by jQuery
If InStr(1, Request.ServerVariables("ALL_HTTP"),
"HTTP_X_REQUESTED_WITH:XMLHttpRequest")>0 Then
 AJAX_REQUEST = True
End If

I personally like to use my own custom header just in case the jQuery
implementation changes and the above stops working. So I configure jQuery to
always send a "x-Method" header, with the value "Ajax". So...

DIM AJAX_REQUEST = False
' Look for "x-Requested-With" header sent by jQuery
If InStr(1, Request.ServerVariables("ALL_HTTP"), "HTTP_X_METHOD:Ajax")>0
Then sQuery = sQuery & "&ajax=y"
 AJAX_REQUEST = True
End If

And the javascript to configure jQuery is:
$.ajaxSetup({ global:true, headers: {"X-Method":"Ajax"} });

Hope this helps....


AHeimlich wrote:
> 
> On 4/6/07, Ariel Jakobovits <[EMAIL PROTECTED]> wrote:
>>
>> Just curious, what changes about the server's behavior when the x-Method
>> is specified as Ajax?
>>
> 
> By itself, it doesn't do anything. But in your server-side code, you can
> look for this (or more accurately, look for an HTTP header named
> "X-Requested-With" with the value "XmlHttpRequest") and alter your code's
> output accordingly (what "accordingly" means is entirely up to you).
> 
> For example, you could have a URL that sends a complete HTML page with
> your
> site's header, footer, navigation, etc when requested normally through the
> browser, but when requested through AJAX it only outputs the content it
> created (without the header and stuff).
> 
> -- 
> Aaron Heimlich
> Web Developer
> [EMAIL PROTECTED]
> http://aheimlich.freepgs.com
> 
> 

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

Reply via email to