× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

how to replace a partial in rails with ajax and jquery

David Lowenfels
Mar 07, 2015
<p>class SomeController &lt; ApplicationController</p> <p>  def show<br>     respond_to do  |format|<br>       format.json { render_to_string partial: 'model/partial', formats: [:html] }<br>     end<br>   end</p> <p>end</p> <p><br> in your javascript:</p> <p>$("#result_parent_container").on( "click", "#ajax-activator" function() {<br>   $( "#result" ).load("&lt;%= some_path %&gt;", function() {<br>     alert( "Load was performed." );<br>   });<br> });</p>
comments powered by Disqus