I have a _slide.html.erb
partial that is used in the page rendered by my SlidesController's index action. There are controls on this page that allow slides to be added via ajax. This means I need to add new slides to the view from my ajax response handlers.
How can I use my _slide.html.erb
partial from this javascript handler to avoid duplication. I don't want to have a second version of the partial that is stored in and used by javascript.
您可以在action.js.erb模板中呈现部分内容:
$('#someelement').html('<%= escape_javascript(render :partial => "slide.html.erb", :locals => {:name => value}) %>');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.