Outputting jSON in a rails app

前端 未结 3 1556
我寻月下人不归
我寻月下人不归 2021-02-04 12:34

ok, rails 3 new developer here.

I want my jquery to be able to get a json object from the rails 3 application for projects. Here is my controller.

def yo         


        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-04 13:03

    You can set the Accept: application/json header for real REST, or you can add the format to the URL for quick hackery:

    $.ajax({url: '/projects/yourprojects.json', dataType: 'json'});
    

提交回复
热议问题