开发者

Can i return a value instead of a view from my controller?

开发者 https://www.devze.com 2022-12-25 04:47 出处:网络
I would like to return the id of a newly created object for my ajax call instead of returning the view associate开发者_StackOverflow社区d with the controller method.You can do

I would like to return the id of a newly created object for my ajax call instead of returning the view associate开发者_StackOverflow社区d with the controller method.


You can do

render :text => @your_object.id

and then cast your responseText to integer in the javascript handler if needed.


yes , you can .

render :text=> "the text that you want to return"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号