How to respond to HTML requests made via AJAX in Rails

后端 未结 4 380
一生所求
一生所求 2021-02-03 15:12

I\'m trying to write a Rails controller method that will respond to get requests made both \"normally\" (e.g. following a link) and via ajax.

Normal Case: The controller

4条回答
  •  借酒劲吻你
    2021-02-03 16:10

    If you're using a new version of rails you can just append .js onto the path and it will infer that the request is a JavaScript call

提交回复
热议问题