######## Short version:
I need an ajax version of “redirect_to” that either
triggers the browser to do a new XHR (XML-HTTP-Request)
triggers rails to behave as if a clean new XHR had come in.
######## Long version:
I have an existing non-ajax rails website. I want to change it in the
that I can toggle a switch and the site uses link_to_remote instead of
link_to. This job is done, it works fine. The solution uses .rjs
which make the changes by calling “page.replace_html” for the dynamic
of the page. So far so good.
Now I need an ajax-version for all the “redirect_to”'s in the existing
I see two possible solutions here:
- Tell the browser to do a new XHR
The helper “link_to_remote” produces someting like:
I need an rjs template that, if interpreted by rails and received by the
browser, tells the browser to behave as if the user klicked on the above
Again with other words: what does an .rjs template look like that tells
browser to do an XHR immediately?
- Tell rails to forget everything it did so far and behave as if there
a new request x coming in
Is it possible and if how to tell rails: Reset everything you did for
current browser request and then handle the following action call as if
was produced by a clean new browser request (including everything,
especially the rendering)?
######## Call for help
I followed both ways for hours but didn’t succeed. My knowledge of rails
internals isn’t experienced enough by now. Any help is very much