title: Can one replace xhr.onreadystatechange with xhr.onload for AJAX calls?
body: <p>I need to support major modern browsers only (IE10+, FF, Chrome, Safari)</p>
  
  <p>Can I make this substitution as I want to simplify my code base:</p>
  
  <p><strong>From:</strong></p>
  
  <pre><code>xhr.onreadystatechange = function () {
      if (this.readyState === 4) {
          if (this.status === 200) {
              o.callback(xhr.responseText);
          } else {
              return false;
          }
      } else {
          return false;
      }
  };
  </code></pre>
  
  <p><strong>To:</strong></p>
  
  <pre><code>xhr.onload = function (test) {
      o.callback(xhr.responseText);
  };
  </code></pre>
  
  <p>I don't feel that the <a href="https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest" rel="noreferrer">MDN documentation</a> is clear in this regard.</p>
  
  <p><strong>Clarification:</strong></p>
  
  <p>I choose not to use a framework.</p>