1

I'm following along the ReactJS tutorial for creating a Comments section (found here).

Everything seems to be working fine except for creating new comments. When I send the POST request by submitting the new comment, the server (Python's SimpleHTTPServer) returns 501: Unsupported method ('POST')

Here is the ajax call:

handleCommentSubmit: function(comment) {
  $.ajax({
    url: this.props.url,
    dataType: 'json',
    type: 'POST',
    data: JSON.stringify(comment),
    success: function(data) {
      console.log("Successful POST to" + this.props.url);
      this.setState({data: data});
    }.bind(this),
    error: function(xhr, status, err) {
      console.error(this.props.url, status, err.toString());
    }.bind(this)
  });
}

I've been debugging the app for a while and I know the handler is getting called. Firefox's console prints the error message and I've stepped through it with the debugger.

Hugo
  • 2,186
  • 8
  • 28
  • 44
  • http://stackoverflow.com/questions/15876926/jquery-501-error-unsupported-method-post – Ruben Kazumov Dec 22 '14 at 21:15
  • In other words, it's not me, but the server? – Hugo Dec 22 '14 at 21:17
  • duplicate of [How can I create a web service endpoint for a locally served JSON file](http://stackoverflow.com/questions/26064533/how-can-i-create-a-web-service-endpoint-for-a-locally-served-json-file) – Brigand Dec 23 '14 at 12:17

0 Answers0