Changing url

I have an ajax form. When it doesn’t get saved, I just
params[:not_saved] = true
render :action => :index

<% if params[:not_saved] %>
//show the form
<% end %>

On the form, I have a link_to_remote “Cancel” to close the ajax form,
but hitting cancel doesn’t change the url. This is the URL:

page[:form].visual_effect :slide_up

How can I change the url without redirect_to ? When a user hits
‘cancel’, I want the URL to not include ‘/save_requirement’ anymore.


You can always change the URL via the JavaScript property
window.location. However, if you set it, you’ll get redirected to
that URL. The standard AJAX solution is to set window.location.hash,
which will modify the URL to indicate state change, but will not
redirect user to a new page. More can be learned from,
just search for ‘bookmarkability’.


On Jul 31, 9:46 am, Justin To [email protected]

Thanks, looks promising!