[jQuery] Calling $.ajax with fully qualified URL broken?
If I try to call $.ajax with a fully qualified url, nothing happens at
all:
$.ajax(
{
type: "GET",
url: "http://www.google.com/",
dataType: "html",
success: function(data)
{
alert(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
alert(textStatus + errorThrown);
}
});
If I call it without the "http://" the alert in the error function
shows "errorundefined":
$.ajax(
{
type: "GET",
url: "www.google.com",
dataType: "html",
success: function(data)
{
alert(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
alert(textStatus + errorThrown);
}
});
If I call it with the url encoded, I also get "errorundefined" from
the alert in the error function:
$.ajax(
{
type: "GET",
url: "http%3A%2F%2Fwww%2Egoogle%2Ecom%2F",
dataType: "html",
success: function(data)
{
alert(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
alert(textStatus + errorThrown);
}
});
All of the examples I see show calling this function with a relative
URL, was it not intended to go used to download content from other
domains?