error handling - Storing a xmlhttprequest on an object -
i want store xhr status. first creating empty object , want push xhr.onload on because console.log('done', xhr) gives me need. not succeeding in pushing onto object. doing wrong?
var networkerror = {} var xhr = new xmlhttprequest(); console.log('unsent', xhr.status); xhr.open('get', '/server', true); console.log('opened', xhr.status); xhr.onprogress = function () { console.log('loading', xhr); }; xhr.onload = function () { console.log('done', xhr); networkerror.push(xhr) } xhr.send(null); console.log ('--->'+networkerror) console.log(networkerror) not give me anything.
Comments
Post a Comment