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

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -