Can any body tell me what should i do in my code it works fine in firefox and other browsers but not in IE.
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
If any body tell me how should i initialize ActiveXobject which should work in all IE versions.
Thanks in advance
My javascript code dont work in IE but work in others
Moderator: General Moderators
Re: My javascript code dont work in IE but work in others
If I remember correctly ActiveX name is case sensitive and I think "Msxml2.XMLHTTP" should be "MSXML2.XMLHTTP".
From jQuery source:
Please use
From jQuery source:
Code: Select all
function xhr() {
return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
}Code: Select all
tags in your next post.Re: My javascript code dont work in IE but work in others
Thank you sir to send me above code i write it in capital letters but it still isnt working.
Actually i want to get server time and pass it to js function of new date(servertime), but there is no method of getting server time in java script it only exists in PHP. If any body knows any method of javascript which can get server time without involving PHP.
Thanks.
Actually i want to get server time and pass it to js function of new date(servertime), but there is no method of getting server time in java script it only exists in PHP. If any body knows any method of javascript which can get server time without involving PHP.
Thanks.