I am just following a tutorial in AJAX and I discover there is an error:[Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.
Here are my codes
index.php
<script type="text/javascript">
function getcontent()
{
//creating an instance of the HTTP request object
var xmlHttp = new XMLHttpRequest();
//specify the method and url
xmlHttp.open("GET", "game-list.php", false);
xmlHttp.send(null);
//xmlHttp.responseText = game-list.php
var element = document.getElementByID("content");
element.innerHTML = xmlHttp.responseText;
}
</script>
<form>
<input onclick="getcontent()" type="button" value="get content">
</form>
<div id="content">
</div>
game-list.php
<ul>
<li>Witcher 3</li>
<li>Mass Effect 3</li>
<li>Heroes of Might & Magic III</li>
<li>World of Warcraft</li>
</ul>
I have no idea on this error and I just following a tutorial
the errors from my chrome browser
index.php:8 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
getcontent @ index.php:8
onclick @ index.php:20
index.php:14 Uncaught TypeError: document.getElementByID is not a function
at getcontent (index.php:14)
at HTMLInputElement.onclick (index.php:20)
getcontent @ index.php:14
onclick @ index.php:20