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.