jQuery Address - redirect after form submit

Posted by Stian on Stack Overflow See other posts from Stack Overflow or by Stian
Published on 2010-04-08T11:27:21Z Indexed on 2010/04/08 11:33 UTC
Read the original article Hit count: 325

Filed under:
|
|
|

Hello all,

I use jQuery and AJAX to load content from links and forms into a content div. In addition I use the Address plugin to enable the back button and refresh. On the server side I use Java and Spring MVC.

Since I'm using jQuery Address and AJAX the only page that is directly loaded is "index.html". Everything else is loaded into a content div, and what page to load is specified in the hash, ie. "index.html#/users/add.html" will load "users/add.html".

Now, "users/add.html" contains a form for creating a new user. When the form is submitted and everything went OK, the controller redirects to "users/index.html". The problem is that jQuery Address doesn't know about the redirect, so the url will remain "index.html#/users/add.html". And this is a problem when you refresh the page and then get sent back to the form, instead of the index page.

Is there a way to fix this problem?

Thanks,
Stian

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about deep-linking