My index.js.erb is refreshing the page only partially:
$("#view").html("<%= escape_javascript render 'view' %>");
I am able to refresh it fully in the controller with this line:
format.js { render :js => "window.location.replace('#{url_for(:controller => :view, :action => :index, :some_parameter => value)}');" }
Is it possible to refresh the page in js.erb?
edit:
I call index.js.erb by this command in the controller:
format.js { redirect_to(:action => :index, :format => :js, :some_parameter => value)},
It refreshes the page with the content for some_parameter, but refreshes it only partially.
window.location works better, but I read in one of stack overflow posts that it is better to use erb than controller for javascript. Is it really?
For the second way, you’re refreshing the whole page( made another http request ) and if you want to do this, why not just use
redirect_to?