jquery - Render partial onclick in rails -


is possible render partial when link clicked?

i have searched google , here can't find useable.

thanks

yes possible. following example uses jquery, tagged :

in view file (the page displayed) :

<%= link_to "display new view", path_to_controller, :remote => true %> 

in controller action (path_to_controller), add js response :

respond_to |format|   format.js end 

and in path_to_controller.js.erb (the js response file) :

$("#your-placeholder-id").prepend('<%= escape_javascript(render 'path/to/view') %>'); 

hope helps!


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -