Expand|Select|Wrap|Line Numbers
- var xmlReqs = new Array();
- function CXMLHttp(cb,data,xmlHttp)
- {
- this.cb = cb;
- this.data = data;
- this.xmlhttp = xmlHttp;
- }
- function ajaxConnect(page,cb,data)
- {
- var xmlHttp;
- try
- {
- // Firefox, Opera 8.0+, Safari
- xmlHttp=new XMLHttpRequest();
- }
- catch (e)
- {
- // Internet Explorer
- try
- {
- xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch (e)
- {
- try
- {
- xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch (e)
- {
- alert("Your browser does not support AJAX!");
- return false;
- }
- }
- }
- xmlHttp.onreadystatechange=function()
- {
- for (var i=0; i < xmlReqs.length; i++)
- {
- if (xmlReqs[i].xmlhttp.readyState == 4)
- {
- alert('got ' + xmlReqs[i].xmlhttp.responseText);
- xmlReqs[i].cb(xmlReqs[i].data, xmlReqs[i].xmlhttp.responseText);
- xmlReqs.splice(i, 1); i--;
- }
- }
- }
- var i = xmlReqs.push(new CXMLHttp(cb,data,xmlHttp));
- i--;
- xmlReqs[i].xmlhttp.open("GET", page, true);
- xmlReqs[i].xmlhttp.send(null);
- }
ajaxConnect('get_item.php?ajax=1&item=' + item, onItem, tem);
The trouble is when it hits the alert, another debugging session shows that the xmlhttp property seems to be empty. I've been staring at this for a day now but I don't see the problem. I know I'm doing some newbie error, but I don't yet see it. Any help?