how to use rails format.json [closed]

眉间皱痕 提交于 2019-12-03 11:08:13
  1. It's used to return JSON.
  2. No, it renders @cellphones as JSON. You may create a view, though, for example, using a JSON builder to customize the output beyond what Rails provides out of the box.
  3. JavaScript is often used to make JSON Ajax requests, like for client-side frameworks.
  4. Ajax calls often want JSON as a result. They may also request HTML to render directly.
  5. That is an example of how to use it; make an Ajax request to /cellphones.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!