hi,
basically i have this function.
function showDetail(checkBoxShipmentId)
{
xmlhttp = GetXmlHttpObject(); // this calls function below
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="detailBackend.php";
url=url+"?shipmentid="+checkBoxShipmentId; //?shipmentid = value of the checkbox, which is the shipmentid
url=url+"&ran="+Math.random();
if(xmlhttp.readyState ==4)
{
xmlhttp.onreadystatechange= displayDetail;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
else
{
status = xmlhttp.readyState;
alert(status); ///// this always return 0 /////
}
}
which calls this function to initialize xmlhttp
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}
/******** i also have this function which is working *******/
var xmlhttp;
function showShipment(shipmentIdFromDropDown)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="responsexml.php";
url=url+"?q="+shipmentIdFromDropDown;
url=url+"&ran="+Math.random(); //generate a random number and store to variable ran to make sure cookie or session don't make them all the same
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
Q: i am wondering if I have 2 functions calling the GetXmlHttpObject() function,,,, would that cause conflict or something? I really don't think it should.
Thanks for helping AJax newbie...