how to load an html fragment in rails with jquery? -


i wondering how may jquery.load html fragment returned model's show action. example, $("#container").load("/posts/34"). problem returns view want embedded in layout, if visit url in browser. only want post's show html fragment.

thanks!

clarification: want show view continue render within application layout when going show action in browser. i'm merely trying figure out how fetch only html of show view when want load asynchronously jquery. have seen guides in create show.js.erb , render html view there, seems pretty messy me, escaping of html javascript. if accepted , proper way of doing though guess i'll follow standard. wondering if possible fetch html of particular view.

you can use :layout => false in render statement return fragment without layout:

def show   ...   render(:layout => false) if request.xhr? end 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -