PDA

View Full Version : JSON error



Kurt001
11 Mar 2011, 9:14 AM
Hi there,

I start a JSON call and receive the following error in the console:
Ressource was interpreted as Script, but was transfered as MIME-Typ text/html.

Here is my call:


var makeJSONPRequest = function() {
// Ext.getBody().mask('Loading...', 'x-mask-loading', false);
Ext.util.JSONP.request({
url: 'http://www.gameHeaders.com/Games/MakerList',
extraParams: 'application/x-www-form-urlencoded',
callbackKey: 'isSearch',
method: 'POST',
params: {
firstname: 'Peter',
lastname: 'Moleneux'
},
callback: function(results) {
console.log(results);
}
});
};

If you know anything about it, please let me know.

Best
Kurt

glarotech
14 Mar 2011, 2:14 AM
Try to add the following header to the response of your script (http://www.gameHeaders.com/Games/MakerList):


Content-type: text/javascript

Also check your callback key...

Kurt001
14 Mar 2011, 2:56 AM
Thanks. It turned out that I had to go with Ajax and then it was


Ext.Ajax.defaultHeaders = {
'Accept': 'application/json',
},