I have tried the following code, but the AJAX call does not get a response.
Please tell me why I am getting a failed AJAX call.
$.ajax({
type: "GET",
dataType:"html",
url: "http://www.example.com",
//url = any url other than the same domain
success: function(response,status){
alert(status);
//$("#search_text").val("");
//$("#search_results").html(msg);
//setTimeout('refresh()',2000);
//alert($("#sw_hdr"));
}
});
You can’t use AJAX to communicate across domains. Well, you can but jQuery’s Ajax function won’t do it. Look up XSS attacks for more information
Here is a link for reference: http://en.wikipedia.org/wiki/Cross-site_scripting