Use explicit $.ajax dataType and add error callback
Ivan Kozik committed
Dec 29, 2013 at 05:29 UTC
f03d6e212a8ec18c56d26b431e2005ec401efccb
1 file changed
+4
docs/docs/tutorial.md
+4
@@ -383,8 +383,12 @@ var CommentBox = React.createClass({
383
getInitialState: function() {
384
$.ajax({
385
url: 'comments.json',
386
+ dataType: 'json',
387
success: function(data) {
388
this.setState({data: data});
389
+ }.bind(this),
390
+ error: function(xhr, status, err) {
391
+ console.log("comments.json", status, err.toString());
392
}.bind(this)
393
});
394
return {data: []};