I would recommend *not* having an onclick handler in your html. Instead, add an event listener when the documents [readystate changes](https://developer.mozilla.org/en-US/docs/Web/Reference/Events/readystatechange)