Dear All, I have one js file with a ajax call which is working fine in IE6, but not in IE7 or FF. Can somebody help?
window.onload = function() {
var xmlhttp;
var url = "myurl";
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
debugger;
alert("Hello");
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else {
alert("Your browser does not support XMLHTTP!");
}
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
alert(xmlhttp.responseText);
}
}
}
In IE7 I am getting access denied error. Please help.
EDIT: I am now trying it using jQuery, Code:
$(function() {
$.ajax(
{
type: "GET",
url: "myurl",
datatype: "html",
success: function(xhtml) {
$("#con").html(xhtml);
},
error: function() {
displayMessage(......);
}
});
});
Still its working in IE6 but not in Others.If its a cross domain issue, then how to solve this?