Used to get the ready state handler for the AJAX call:
function getReadyStateHandler(xmlObject, responseXmlHandler)
{
return function ()
{
// If the request's status is "complete"
if (xmlObject.readyState == 4)
{
// Check that a successful server response was received
if (xmlObject.status == 200)
{ responseXmlHandler(xmlObject); }
else
{
// An HTTP problem has occurred
alert("HTTP error: "+xmlObject.status);
}
}
}
}
Used to create the xml request object for AJAX calls:
function getXMLHttpRequest()
{
var xmlObject = false;
if (window.XMLHttpRequest)
{
//Create non-Microsoft
xmlObject = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
//Create ActiveX, first for modern browsers
try
{ xmlObject = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (ex1)
{
//Older MS-Browser compability
try
{ xmlObject = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (ex2)
{
/*Could not create ActiveX at all.*/
return false;
}
}
}
return xmlObject;
}