javascript - redirecting/reloading page in js.erb instead of controller -


my index.js.erb refreshing page partially:

$("#view").html("<%= escape_javascript render 'view' %>"); 

i able refresh in controller line:

format.js { render :js => "window.location.replace('#{url_for(:controller => :view, :action => :index, :some_parameter => value)}');" } 

is possible refresh page in js.erb?

edit: call index.js.erb command in controller:

format.js { redirect_to(:action => :index, :format => :js, :some_parameter => value)},  

it refreshes page content some_parameter, refreshes partially.

window.location works better, read in 1 of stack overflow posts better use erb controller javascript. really?

for second way, you're refreshing whole page( made http request ) , if want this, why not use redirect_to?


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -