Skip to content

Conversation

@ivan
Copy link
Contributor

@ivan ivan commented Dec 29, 2013

Working through the tutorial, I ran into a perplexing problem caused by my .json file being served as text/html instead of application/json:

https://ludios.org/tmp/react-json-wrong-mime-type_.png

An explicit dataType argument makes the server's incorrect Content-Type irrelevant.

After I specified the json dataType, my application silently failed to load comments because my .json file had a trailing semicolon. This PR adds an error callback that logs errors to the console. .toString() is necessary to print the exception message in Chrome 31 and Firefox 26.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.error() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed

petehunt added a commit that referenced this pull request Dec 29, 2013
Use explicit $.ajax dataType and add error callback
@petehunt petehunt merged commit 82c4e89 into facebook:master Dec 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants