stockton Posted August 29, 2007 Share Posted August 29, 2007 Can someone please explain to me why the following code works perfectly in Firefox but fails in Internet Explorer? function getXMLHttpRequest () { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {}; try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}; try { return new XMLHttpRequest(); } catch(e) {}; return null; } // Make the XMLHttpRequest object var http = getXMLHttpRequest(); function sendRequest(Mode, Event, CardNumber) { // Call PHP script for requests /* For debug purposes */ document.getElementById("loadingNode").value = "Calling TI3SGM-3.php"; http.open('get', 'TI3SGM-3.php?EventID='+Event+'&MemberNum='+CardNumber); http.onreadystatechange = handleClientDataResponse; } function handleClientDataResponse() { // document.getElementById("loadingNode").value = "Ons wag vir 'n wenner"; if(http.readyState == 4 && http.status == 200) { // Text returned from the PHP script var response = http.responseText; if(response) { // UPDATE ajaxResponse content var parts = response.split("|"); var MemberName = document.getElementById("MemberName"); if (!MemberName) { alert("We have a problem!"); } // alert(response); document.getElementById("CNumber").innerHTML = parts[0]; document.getElementById("MemberName").innerHTML = parts[1]; var SlotsValue=parseInt(parts[2],10); if (isNaN(SlotsValue)) SlotsValue=0; document.getElementById("SlotsValue").innerHTML = SlotsValue; var SlotsTurnover=parseInt(parts[3],10); if (isNaN(SlotsTurnover)) SlotsTurnover = 0; document.getElementById("SlotsTurnover").innerHTML = SlotsTurnover; var SlotsIssued=parseInt(parts[4],10); if (isNaN(SlotsIssued)) SlotsIssued = 0; document.getElementById("SlotsIssued").innerHTML = SlotsIssued; var TablesValue=parseInt(parts[5],10); if (isNaN(TablesValue)) TablesValue = 0; document.getElementById("TablesValue").innerHTML = TablesValue; var TablesTurnover=parseInt(parts[6],10); if (isNaN(TablesTurnover)) TablesTurnover = 0; document.getElementById("TablesTurnover").innerHTML = TablesTurnover; var TablesIssued=parseInt(parts[7],10); if (isNaN(TablesIssued)) TablesIssued = 0; document.getElementById("TablesIssued").innerHTML = TablesIssued; document.getElementById("Earned").innerHTML = SlotsValue+TablesValue; var BonusValue=parseInt(parts[8],10); if (isNaN(BonusValue)) BonusValue = 0; document.getElementById("BonusValue").innerHTML = BonusValue; var BonusIssued=parseInt(parts[9],10); if (isNaN(BonusIssued)) BonusIssued = 0; document.getElementById("BonusIssued").innerHTML = BonusIssued; document.getElementById("Total").innerHTML=SlotsValue+TablesValue+BonusValue; var IssuedValue=parseInt(parts[10],10); if (isNaN(IssuedValue)) IssuedValue = 0; IssuedValue = SlotsIssued+TablesIssued+BonusIssued; document.getElementById("IssuedValue").innerHTML = IssuedValue; var TotalValue=SlotsValue+TablesValue+BonusValue; var OutstandingValue=TotalValue-IssuedValue; document.getElementById("OutstandingValue").innerHTML = OutstandingValue; var MayIssue=parseInt(parts[11],10); if ((OutstandingValue > 0) && (MayIssue == 1)) { document.getElementById("Issue").disabled=false; document.getElementById("Issue").src = 'images/issue.png'; } document.getElementById("loadingNode").value = ""; // document.getElementById("ajaxResponse").value = response; // confirm(parts[0]); } } else if (http.readyState < 4) { // document.getElementById("loadingNode").value = "Loading........"; ShowAjaxStatus(http.readyState); } function ShowAjaxStatus(What) { document.getElementById("loadingNode").value = "Ons wag"; if(What == 0) { document.getElementById("loadingNode").value = "Uninitialized........"; } else if(What == 1) { document.getElementById("loadingNode").value = "Loading........"; } else if(What == 2) { document.getElementById("loadingNode").value = "Loaded........"; } else if(What == 3) { document.getElementById("loadingNode").value = "Interactive........"; } } Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted August 31, 2007 Share Posted August 31, 2007 i had an issue where I was trying to split my response with | and it wasn't working well. instead, I changed what I split my response with to something like <p>split-here</p>. Quote Link to comment Share on other sites More sharing options...
stockton Posted September 2, 2007 Author Share Posted September 2, 2007 Thanks for your suggestion but it was a typo. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.