Javascript error in Firefox 3.6
I have the following JavaScript code:
var xmlHttpReq = getXmlHttpObject();
xmlHttpReq.onreadystatechange=function(){
if (xmlHttpReq.readyState == 4) {
var res =xmlHttpReq.response;
var result = res.split(',');
if (document.getElementById("shoppingCardAjax")!=null){
document.getElementById("shoppingCardAjax").innerHTML = overAllPayment + result[1];
}
}
on Chrome this code works flawle开发者_C百科ss, but on Mozilla 3.6 I'm getting error:
res is undefined
var result = res.split(',');
Why? What's the difference?
xmlHttpReq.response
should be xmlHttpReq.responseText
PS: Why don't you use a nice lib like jQuery instead of doing all the XHR stuff manually?
精彩评论