Hello All,
I am using Ajax method to read a html file and show the content in a div. I use ajax method to read the html file. What happens now is this works perfectly in IE(all versions) and Mozilla (2 and below) and but not in Mozilla 3 and above. Please help me to solve this. My code is given below.
When i give the last parameter as ‘false’, it works for IE and not for Mozilla 3 and above.
On the other hand when i give ‘true’ for the parameter it works in Mozilla 3.o and not in IE. My website is targetted for both IE and Mozilla users.
To fix this i declared a varaibale, check the browser set it to true on Mozila and false on IE. This worked well for both browsers when i was having an alert to show the param value. When i removed it it stopped for Mozilla and only works on iE.
var param;
if(navigator.appName.indexOf(“Microsoft Internet Explorer”) == 0)
{
param= false;
}
else
{
param= true;
}
if (window.XMLHttpRequest)
{ // code for Mozilla, Safari, ** And Now IE 7
xmlhttp=new XMLHttpRequest();
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType(‘text/html’);
}
} else if (window.ActiveXObject) { //IE
xmlhttp=new ActiveXObject(‘Microsoft.XMLHTTP’);
}
if (typeof(xmlhttp)==’object’) {
xmlhttp.open(‘GET’, ‘http://localhost/TMC/Content/EditDiv.htm’, param);
xmlhttp.setRequestHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);
xmlhttp.onreadystatechange=CheckFilereadyState;
xmlhttp.send(null);
}
Any help will be appreciated
Regards,
Anand