Rick Faircloth wrote:
My biggest question with my server-side code is how to
make sure these three related tasks are handled
Exactly what I'm trying to address.
It would basically be (on the server-side validation page):
- if JS or Ajax is available, return the results that way
- if no JS or Ajax is available then just go the normal route
and refresh the page
How to answer the "if" in the question is what I'm after.
The request you get from the browser should tell you. And, as I said,
if the request is for a new page, it doesn't do you any good to
magically see if JS is available, since if you don't return a full page,
the browser is going to choke. And if the request was for an AJAX
response, wrongfully determining that JS is off and returning the whole
page is just going to throw errors in your working JS.
> This discussion is disappointing so far, in that there seems to be no
> way to determine if the call were made via Ajax. Correct?
From server-side code alone? Yes. That's what we've all been saying.
But the client side request can tell the server this. 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.
-- Scott