开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜