我如何成为一个静态的JSON对象从轨文件? (我要访问它在一个Ajax调用)?
How do I serve a static JSON object from a file in rails? (I want to access it in an ajax call)?
什么是最好的方法是什么?
What is the best method?
只需将要在一个变量来渲染一下,然后用渲染:JSON =>变量
有合理的默认值列表,http://stardict.sourceforge.net/Dictionaries.php下载,等等...
Just place what you want to render in a variable, then use render :json => variable
There are sensible defaults for lists, dicts, etc...
请参阅此: http://guides.rubyonrails.org/layouts_and_rendering.html
项:2.2.8渲染JSON
Item: "2.2.8 Rendering JSON"
上一篇:如何让浏览器超时(长PHP脚本)脚本、浏览器、PHP
下一篇:错误:" CSRF验证失败。请求中止与QUOT。使用与Django的jQuery的Ajax时错误、QUOT、CSRF、Ajax