danny.lesnik
danny.lesnik

Reputation: 18639

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 flawless, but on Mozilla 3.6 I'm getting error:

res is undefined
var result = res.split(','); 

Why? What's the difference?

Upvotes: 0

Views: 155

Answers (1)

ThiefMaster
ThiefMaster

Reputation: 318508

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?

Upvotes: 2

Related Questions