Ok i’ve done a bit of hunting around and I can’t find much
documentation on how ensure an ajax call through an rjs file degrades
with javascript off.
Essentially, if javascript is off, I want to refresh the page and pass
a variable from the controller to the page the user is on. Not use the
rjs file.
At the moment i have this:
<%= link_to_remote(“Advanced Search”,
{:url => { :controller => "base",
:action => "advSearchAJAX" }},
{:href => url_for( :controller => "base",
:action => "advanced_search" )}
)%>
Essentially it just show/hides an advanced search if the user has
javascript on. The :href is used when javascript is off and sends the
user to a new page.
However, this isn’t ideal as i’d like use just one controller and to
not change the page the user is on, just refresh it with the advanced
search now displaying.
I had thought I could pass through a variable from the controller that
could be used to display the advanced search. like so:
<div id="adv_search"
<% unless @display == "show" -%>
style="display: none">
<% end -%>
<%= render :partial => "shared/layout/advanced_search" %>
</div>
I believe in my controller I can use
if !@request.xhr?
to check if it’s an ajax request. The problem I have is how to refresh
the page the user is on and not use the rjs file.
Any help, much appreciated.
Paul.
–