Reputation: 23
$(document).ready(function() {
$.ajax({
type: 'GET',
url: "http://www.google.com/ig/calculator?hl=en&q=1GBP=?USD",
dataType: "json"
}).done(function() {
alert("success");
}).fail(function() {
alert('fail');
});
});
I'm new to this so please can someone tell me why does this fail? In firebug I am getting '200 OK' for the request.
Upvotes: 2
Views: 544
Reputation: 120168
You can't make an ajax request to www.google.com unless the script from which the ajax request originates is loaded from www.google.com. It's called the Same Origin Policy. Browsers won't do it.
Upvotes: 5
Reputation: 14025
You are facing to a "cross-domain" request exception.
Here is one of plenty related topic : Cross domain exception
Upvotes: 1