Nour El-din El-helw8,229 Points
I don't know what I'm doing wrong
For some reason nothing appears in my HTML that's generated by JS , I checked all my code and I don't see anything wrong. I'm using Visual Studio code and using a local host(MAMP) so I can do the AJAX request. I've put my code into the workspace for this video so I can make a snapshot of it. So here it is https://w.trhou.se/jmv8pxs45d . EDIT: I tried it in the workspace and it worked so can someone please explain this?
Steven Parker201,316 Points
It's not an error for "statusHTML" to be "undefined" in the console. Since it's declared inside the handler function for
onreadystatechange, it's scope is limited to that function.
If you'd like to be able to examine it from the console, you might want to declare it outside the function as a global.