How to escape from AJAX URL

This may be a bit difficult to explain, but here goes.

I’m developing a web site which has a nice AJAX part to it (thanks to
rails). You just click on the link and it take you to the ajax part
which is on a seperate page.

-The user then selects directories or files from via a multiple menu.

-When the user selects a directory (and hits the submit button) the menu
is updated with the next directory selected.

-When the user selects a file (and hits the submit button) the
application should go back to the previous page and display the file
he/she selected.

OK this does work apart from the fact that after the file is selected
and the page goes back, the URL is still displaying the AJAX enhanced
page. I’d like it to display the URL of the page it went back to
otherwise I know the user will start to question this.

does anyone know how to escape from that?

Cheers.

fish man wrote:

This may be a bit difficult to explain, but here goes.

I’m developing a web site which has a nice AJAX part to it (thanks to
rails). You just click on the link and it take you to the ajax part
which is on a seperate page.

-The user then selects directories or files from via a multiple menu.

-When the user selects a directory (and hits the submit button) the menu
is updated with the next directory selected.

-When the user selects a file (and hits the submit button) the
application should go back to the previous page and display the file
he/she selected.

OK this does work apart from the fact that after the file is selected
and the page goes back, the URL is still displaying the AJAX enhanced
page. I’d like it to display the URL of the page it went back to
otherwise I know the user will start to question this.

does anyone know how to escape from that?

Cheers.

I think the last step you can use redirect the whole page to the one you
want instead of using Ajax to update part of it.

-Tony

yes I did try that, using redirect_to :action => ‘blahblahblah’
but the URL was still the Ajax page so if you hit refresh it goes back
to the original ajax page. but if i hit the back button it gives me what
I want.

Tony J. wrote:

fish man wrote:

This may be a bit difficult to explain, but here goes.

I’m developing a web site which has a nice AJAX part to it (thanks to
rails). You just click on the link and it take you to the ajax part
which is on a seperate page.

-The user then selects directories or files from via a multiple menu.

-When the user selects a directory (and hits the submit button) the menu
is updated with the next directory selected.

-When the user selects a file (and hits the submit button) the
application should go back to the previous page and display the file
he/she selected.

OK this does work apart from the fact that after the file is selected
and the page goes back, the URL is still displaying the AJAX enhanced
page. I’d like it to display the URL of the page it went back to
otherwise I know the user will start to question this.

does anyone know how to escape from that?

Cheers.

I think the last step you can use redirect the whole page to the one you
want instead of using Ajax to update part of it.

-Tony

use RJS templates… I had this “exact” problem, but RJS did the trick.
within my “login.rjs” template that get’s invoked after my login
process, it
returns to the same page with an error message on error, or… if the
login
was successful, it needs to “redirect” to another controller… which is
pretty much impossible to do otherwise. so, my “login.rjs” looks like:

if @logged_in_client
page.replace_html “message”, :partial => ‘shared/bad_login’
else
page.redirect_to “whatever you want here”
end

i was scared to use edge rails at first, but now i swear by it :slight_smile: