Take the 2-minute tour ×

I'm trying to figure out if I can do the following:

  1. User submits form to script via jquery post
  2. Depending on what was processed, script may or may not return errors
  3. If the script did not process any errors (i.e. SUCCESS), I want to redirect to a SUCCESS page

I know it's possible to redirect the browser via javascript, but I'm worried if some users have javascript disabled the entire flow might get messed up.

Thanks in advance.

share|improve this question
Moot point; if they have JavaScript disabled, your jQuery postback can't work in the first place. –  meagar Feb 26 '10 at 18:27
add comment

1 Answer

up vote 3 down vote accepted

As you want to evaluate the form (currently) with jQuery, you can safely assume that, when the form is evaluated, JavaScript is available.

For those without JavaScript, you should add some server side routine, that does the job. And then you can use a redirect via HTTP header, or a <meta> redirect.

To keep both ways working, hard code the server side routine into the code, and replace it via jQuery when the page is loaded. JavaScript users will execute the jQuery replacement and get the jQuery evaluation; other's will just stay with the normal version.

share|improve this answer
add comment

Your Answer


