I\'m getting the following error
Uncaught TypeError: Cannot read property \'appendChild\' of null myRequest.onreadystatechange @ script.js
Uncaught TypeError: Cannot read property \'appendChild\' of null
myRequest.onreadystatechange @ script.js
There isn't an element on your page with the id "mainContent" when your callback is being executed.
In the line:
document.getElementById("mainContent").appendChild(p);
the section document.getElementById("mainContent") is returning null
document.getElementById("mainContent")
null