Respond to Ajax


/ Published in: Rails
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # CHANGED: Don't do this.
  2. # if request.xhr?
  3. # render :action => "add_with_ajax"
  4. # else
  5. # redirect_to :controller => "catalog"
  6. # end
  7. respond_to do |format|
  8. format.html {redirect_to :controller => "catalog"}
  9. format.js {render :action => "add_with_ajax"}
  10. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.