-
2 Nov 2012 6:35 AM #1
Unanswered: How to accept JSONP with text/plain MIME type?
Unanswered: How to accept JSONP with text/plain MIME type?
Hi
I'm trying to load basic JSON from an external source that I don't have control of, using the proxy:
However, I get this error:Code:proxy: { type: 'jsonp', url: 'http://thejsonurl....', reader: { type:'json', rootProperty:'' } }Is there a way around this?Code:Resource interpreted as Script but transferred with MIME type text/plain:
Cheers
-
2 Nov 2012 8:14 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3102
Your response needs to return the Content-Type header as application/javascript. For PHP you can do it like:
PHP Code:header('Content-Type: application/javascript');
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
2 Nov 2012 2:03 PM #3
-
2 Nov 2012 3:06 PM #4
Oh well, my workaround was to have a separate php file that basically grabbed the external json and echo'd it out with the proper headers, and then change the proxy type to ajax.
This actually makes sense anyway for me if the external data source changes
Code:header('Content-type: application/json'); $html = file_get_contents('http://external_json_file'); echo $html;


Reply With Quote