Reputation: 19
Hi i know this is common question but i didnt see any solution to mine yet.
This is my code:
$.ajax({
url: "https://my.zipato.com:443/zipato-web/v2/user/init",
dataType: "jsonp",
jsonp: "mycallback",
success: function (data) {
alert(data.nonce);
}
});
Server responds with json and i see response in console but error missing ; before statement because it is json not jsonp which i need. Ok but when i chanege dataType to json the i get cross origin problem. I tried test-cors.org and appears that server is not accepting cors. What are my solutions now? I tried lot of examples but none works.
How can i access response that i get a read the info inside, can i override the error i get or something? I cannot access the server to change anything.
Upvotes: 0
Views: 398
Reputation: 337560
The returned data format is entirely governed by the server you're making the request to, in this case it's plain old JSON. There is nothing you can do to change this.
If the third party server does not support cross-domain requests via JSONP or CORS then you need to use a server-side proxy and then have your JS make the request within your local domain.
Upvotes: 1