Rick Faircloth wrote:
The simplest
thing is just to add a post parameter that says "ajaxOn=true" or some
such, then check for that server-side. It wasn't included in the HTML,
or it was set to false, so if it's true, the server knows to respond
with an AJAX request. It's pretty straightforward.
Well, then, wouldn't that amount to a fool-proof test that Ajax is available
for the server to use as a response mechanism?
Yes, that's what a number of people have been trying to tell you. There
is no useful way for the server side to determine if JS is on, but the
client side can easily *tell* that to the server side.
And I assume by "add a post parameter", you mean a hidden field in the
form or somewhere in the JS code on the calling page with a variable?
Yes, although it could also be done through a parameter added to the
query string or the URL, depending upon how you want to handle it server
side. But the other option, suggested on this thread, to use the HTTP
header HTTP_X_REQUESTED_WITH means no extra work in the JS, and is
probably a better idea, as long as you are sure you will be using JQuery
for a while.
Good luck,
-- Scott