I'm making an Get call for the URL http://google.com to get the html content of the site, But on the ajax call I'm ending up with the following 2 errors,
Error : GET http://www.google.com/ undefined (undefined)
Error : XMLHttpRequest cannot load google.com. Origin "URL of my local website" is not allowed by Access-Control-Allow-Origin.
Code for 1st error:
$.ajax({
type : "GET",
cache : false,
url : url,
dataType : "xml",
crossDomain : true,
contentType : "text/html",
success : function(data){
alert("success");
},
error : function(error){
alert("error");
}
});
Code for 2nd error:
$.ajax({
url : url,
dataType : "text",
success : function(data){
alert("success");
},
error : function(error){
alert("error");
}
});
What settings i need to make to enable the cross domain call,Help would be really appreciated.
I have also tried setting up $.mobile.allowCrossDomainPages = true and $.support.cros = true; before the ajax even this didn't work. Solution would be really appreciated.