maybe you want to use xhr.onload/onerror here? instead of using the xhr.status