You could do `var xhr = new XMLHttpRequest()` then use it in the conditionals that follow, as otherwise it's often instantiated twice.