Friday, August 17, 2012

Return simple javascript from Rails controller without .js.erb file


In controller:
def some_function
  respond_to do |format|
    format.js { render :js => "alert('hello');" }
  end
end

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.