I have a page with table layout which has an AJAX request sent on body onLoad event, during this time the table cells show static text like "Loading". The table cells are later updated with the AJAX response. So when I try to move out of the page once the AJAX request is sent by clicking on a link for exmple, the "Loading" changes to "undefined" . I read that innerHTML is not supported by firefox for table cells so i started using div inside the table cell yet no result. However IE and Opera seems to work fine. could anyone please tell me where am going wrong ?? Thanks a ton
Firefox - 'undefined' error
Collapse
X
-
Thanks for your reply, The ajaxrequest is triggered by the following functions
Please let me know if you need any other piece of code as well.Code:function getReportStatus(geturl) { var columnvals; var filtervals; url = geturl; xmlObj = null; xmlObj = GetXmlObj(); // This function is to choose the right xmlhttp object according to the browser xmlObj.onreadystatechange=stateChanged; xmlObj.open("GET", url , true); xmlObj.send(null); } function stateChanged() { if (xmlObj.readyState==4 || xmlObj.readyState=="complete") { data = xmlObj.responseText; var data_split = data.split("|"); document.getElementById("citystate").innerHTML= data_split[0]; document.getElementById("progress").innerHTML = data_split[1]; document.getElementById("function").innerHTML= data_split[2]; // All the ids above are div element ids which are inside individual <td> elements } /* else if(xmlObj.readyState==1) { document.getElementById("citystate").innerHTML = "HEY"; document.getElementById("progress").innerHTML = "Loading"; document.getElementById("function").innerHTML = "Loading"; } else if(xmlObj.readyState==3) { document.getElementById("citystate").innerHTML = "HEY"; document.getElementById("progress").innerHTML = "Loading"; document.getElementById("function").innerHTML = "Loading"; } */ }
CheersComment
-
once you click the button 'Create Report' you will be inside the report center. Once you are are inside the report center, click on any link just to navigate away from the page. When you click on the link the the table cells which were saying 'Loading' would disappear and you will see 'undefined' appearing in those cells for a very brief time before you end up in the next page.Please let me know if you were able to reproduce it this time. Thanks for your efforts again.Comment
-
The XMLHttpRequest object has an abort() method which you can use or set the variable to null. Just make sure that the request hasn't already finished. If it has, then there's nothing to worry about anyway.Originally posted by acoderYes, it seems it's only triggered if you leave the page.
I'm not sure what might be triggering it, but perhaps you need to abort the request onunload.Comment
Comment