开发者

How to Render a JS response

I have the following in my controller:

  return render :js => "alert('H开发者_JS百科ello Rails');"

Problem is it shows up as text and isn't running as JavaScript. Ideas why?


You just need to remove the "return". The correct code would read

render :js => "alert('Hello Rails');"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜