`JSON.parse` can fail, so I'd be careful how you do this:

```javascript
try {
  onload(JSON.parse(xhr.responseText));
} catch (e) {
  onload.error(new Error("Unable to parse JSON"));
}
```