Use explicit $.ajax dataType and add error callback

This commit is contained in:
Ivan Kozik
2013-12-29 05:29:34 +00:00
parent 9208a5153e
commit c72efb80c5

View File

@@ -383,8 +383,12 @@ var CommentBox = React.createClass({
getInitialState: function() {
$.ajax({
url: 'comments.json',
dataType: 'json',
success: function(data) {
this.setState({data: data});
}.bind(this),
error: function(xhr, status, err) {
console.log("comments.json", status, err.toString());
}.bind(this)
});
return {data: []};