Ajax request is getting an HTML response instead of a json response.
Here is my ajax request:

var that = this;
var url = "/edit_suggestions/" + that.id + "/accept.json";
  type: "PUT",
  url: url,
  success: callback

Here is the code in my controller:

respond_to do |format|
  format.html { redirect_to @suggestion.question }
  format.json { render :json => @suggestion }

Based on looking at my server logs, it completes the first request and then goes into the html response and tries to sent a `put` request to the questions/#{@suggestion.question.id} url instead of just returning the json. This ends with the error that the "get" request to this url failed.
improve this question | comment
Nhull Created at: 2013-11-15 00:39:30 UTC By Nhull
2 Answers
You need to add ".json" to the end of your AJAX requests.
Have you tried turning it off and back on again?
Your Answer