Ram Iyer9,116 Points
What triggers the xhr.send() ?
Since we have written the method directly inside the js file, does it load everytime the file loads. If it does, then how is this useful.
Shouldnt there be a button or something like 'check current status' on which the boss can click and then the AJAX request is sent.
Matthew Fung7,497 Points
The AJAX request is sent on file load, as the browser reads the file. You could, certainly add some kind of timer or button event to trigger it.
The reason that it isn't in this instance is that this course is intended as an introduction. Adding more code to open a AJAX request is unnecessary, since you should be able to change the behaviour in your own projects.