mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 12:43:05 +00:00
Use explicit $.ajax dataType and add error callback
This commit is contained in:
@@ -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: []};
|
||||
|
||||
Reference in New Issue
Block a user