mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +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() {
|
getInitialState: function() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'comments.json',
|
url: 'comments.json',
|
||||||
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
this.setState({data: data});
|
this.setState({data: data});
|
||||||
|
}.bind(this),
|
||||||
|
error: function(xhr, status, err) {
|
||||||
|
console.log("comments.json", status, err.toString());
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
});
|
});
|
||||||
return {data: []};
|
return {data: []};
|
||||||
|
|||||||
Reference in New Issue
Block a user