JavaScript AJAX Basics (retiring) Programming AJAX Create a callback

Christopher Baxter
Christopher Baxter
Pro Student 558 Points

Why is the anonymous function not being accepted in my AJAX callback?

Syntax appears to be correct according to earlier examples given in previous videos but still coming back with an error when I click 'check work'. Any help would be appreciated.

var xhr = new XMLHttpRequest();
xhr.onReadyStateChange = function () {
};'GET', 'sidebar.html');
<!DOCTYPE html>
  <meta charset="utf-8">
  <title>AJAX with JavaScript</title>
  <script src="app.js"></script>
  <div id="main">
  <div id="sidebar"></div>

1 Answer

onReadyStateChange is all lowercase

Christopher Baxter
Christopher Baxter
Pro Student 558 Points

Hi Kris, Spotted this just after posting the question, got to love those typos! Many thanks for responding to the question, much appreciated.