title: JSON AJAX Http request
body: <p>I am working with a JSON file that I have, and I am linking it in my JavaScript. 
   I am trying to get it requested through AJAX to show up on my <code>console.log</code>, but I am just getting <code>null</code> for my <code>readystatechange</code> function. What am I doing wrong? </p>
  
  <p>Also to better clarify I am doing this for my course and ideally what my goal is; I have a json file that I created (myjson.com), I have that URL its in my JavaScript, and I am trying to get that json url to update to my JavaScript so when I do a <code>console.log</code> it shows up the values of the objects from the json. Here's my code:</p>
  
  <pre><code>&lt;div id="btn1"&gt; Update &lt;/div&gt;
  &lt;div id="output"&gt;&lt;/div&gt;
  
  &lt;script&gt;
  
  var output = document.getElementById("output");
  
  document.getElementById("btn1").onclick = function () {
      var a = newXMLHttpRequest();
      a.onreadystatechange = function () {
  
      }
      a.open("GET", "https://api.myjson.com/bins/z79bt", true);
      a.send();
  };
  
  &lt;/script&gt;
  </code></pre>
  
  <hr>
  
  <p>UPDATE</p>
  
  <p>Code from the comment:</p>
  
  <pre><code>var output = document.getElementById("output");
  document.getElementById("btn1").onclick = function () { 
    var a = new XMLHttpRequest(); 
    a.onreadystatechange = function () { 
      if(this.readyState == 4) { 
        var myObj = this.responseText; 
      } 
      console.log(a); 
    } 
    a.open("GET", "api.myjson.com/bins/z79bt";, true); 
    a.send(); 
  };
  </code></pre>