JavaScript AJAX Basics (retiring) AJAX Concepts Finish the AJAX Request

jocelin queau
jocelin queau
4,846 Points

Ajax error : You need to specify the request object and use the open() method on it.

i don't know what i'm doing wrong ..

var request = new XMLHttpRequest();
request.onreadystatechange = function () {
  if (request.readyState === 4) {
    document.getElementById("footer").innerHTML = request.responseText;
  } ("GET","footer.html");
<!DOCTYPE html>
  <meta charset="utf-8">
  <title>AJAX with JavaScript</title>
  <script src="app.js"></script>
  <div id="main">
  <div id="footer"></div>

1 Answer

Adam Beer
Adam Beer
11,269 Points

You are very close. Put it under the function. Hope this help.

jocelin queau
jocelin queau
4,846 Points

thanks a lot ! i passed it thank to your help