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');"
精彩评论