Tuesday, 27 August 2013

JS file works fine on IE but not on other browsers

JS file works fine on IE but not on other browsers

The function below gets results in ie but not on the other browsers. Any
suggestion?
....
function show_packet(str, company)
{
var cam=document.getElementById("company");
if (window.XMLHttpRequest)
{
var xmlhttp=new XMLHttpRequest();
}
else
{
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("packet_1").innerHTML=xmlhttp.responseText;
document.getElementById("icon_1").innerHTML="";
}
}
xmlhttp.open("GET","show_packet.php?car_moto="+encodeURIComponent(str,true)+"&cam="+encodeURIComponent(cam.value,true));
xmlhttp.send();
}
....

No comments:

Post a Comment