|
XMLHttp request takes long time on first load
Hi all,
I am using XMLHttp Request to call a web service and retrieve data from another website. My code looks like this:
// create an XmlHttp instance
objHttp = new ActiveXObject("Microsoft.XMLHTTP");
// Set up the post
if(async == true) //async is false by default
{
objHttp.onreadystatechange = function () { funcPtr(cntrlArray, codeArray, XPathStr) };
}
// send the POST to the Web service
objHttp.open("POST", szUrl, async);
objHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
objHttp.send(strEnvelope);
The last line (send method) always causes a 50 sec delay on initial page load. On subsequent page loads, the delay is less than 3 sec.
Is there anything I can to do to speed up the first execution of the ‘send’ method? I’ve tried setting async to true or false, but there isn’t any difference in performance.
Thanks for the help.
Last edited by multiplex77; 12-13-2007 at 06:41 AM..
|