I am trying to send AJAX requests to other servers using jQuery. I am operating locally. If I use HTML dataType I get the classical Origin http://127.0.0.1 is not allowed by Access-Control-Allow-Origin
. So I started using JSONP requests :
$.ajax({
url: 'SomeRemoteServer/SomeFile',
dataType: 'jsonp',
success: function(data) {
// do stuff
},
error: function(d,msg) {
alert(msg);
}
});
The catched error is parsingerror
and Chrome js debugger outputs Resource interpreted as Script but transferred with MIME type text/html
. After carefully looking for this error on the web I found that the error came from the server and not my script (it should send back MIME type application/json
or something close to this).
Well it seems however that the server is sending something... I would like to catch the response and self-process the parsing. Is this feasible ? If yes how ? I tried $.ajax()
option converters
but without success...