Thursday, January 30, 2014

Rails: specifying callback-javascript in response to Ajax request

respond_to do |format|  
  format.js { render js: "toastr.success('"+successmsg+"')"}
end

If callback-javascript is only 1 line of code or so, then we can avoid creating a new .js.erb file (with name of controller-action) and just include the javascript as above.

No comments:

Post a Comment

Followers

Blog Archive