Reputation: 23811
Here is my jQuery ajax code
$.ajax({
type: "GET",
url: "http://example.com/request=r",
dataType: "json",
processData: true,
data: {},
success: function (responseString) {
alert(responseString);
},
error: function (xhr, errorType, exception) {
var errorMessage = exception || xhr.statusText;
alert("Excep:: "+exception +"Status:: "+xhr.statusText);
}
});
I don't get an exception but I get xhr.statusText as Error
Upvotes: 1
Views: 286
Reputation: 337713
You're falling foul of the Same Origin Policy. The only client-side alternative is to use JSONP request type, if the provider supports it.
If not you'll need to write a server-side proxy to get the data (in PHP/C# etc) and then query that via AJAX instead.
Upvotes: 2