add `var xhr = e.target;` and parameter `e` for the function. use `xhr` instead of this.

Also, could you add `xhr.removeEventListener('readstatechange', onreadystatechange);`