Rails: Rendering Partials through Ajax

后端 未结 3 955
轻奢々
轻奢々 2020-12-16 04:52

I have a page with tabs and I want to just render different partials through ajax when the tabs are clicked upon. I have some code but I don\'t think it is the most efficien

3条回答
  •  暖寄归人
    2020-12-16 05:45

    Prasvin's answer is spot-on. Returning and executing JS may seem simple but it makes debugging much nastier - how do you set a breakpoint in JS that was returned via AJAX? Instead you should include all of your JS in the page and only send data back.

提交回复
热议问题