I am running into a strange problem.
I simply want to display a loading icon on the page when pressing a button.
If my call to form_remote_for
contains Ajax options then the RJS script does not work.
This works ("loading" is hidden by the controller and RJS):
View:
<%=form_remote_for(:job, @job, {:url => {:action=>:create}}) do |f| %>
[...]
<div id="loading">Loading...</div>
controller:
def create render :action => "create.js.rjs" end
RJS:
page.hide 'loading'
This does not work (just adding :loading=>
and loading is shown by the view but not hidden back by the controller as it was before):
<%=form_remote_for(:job, @job, {:url => {:action=>:create}}, {:loading=>"$('loading').show()"}) do |f| %>
[...]
<div id="loading" style="display:none;">Loading...</div>
So if my call to form_remote_for
contains Ajax options then the RJS script does not work. Why?