title: Function call after AJAX request does not work in javascript
body: <p>I have a function where the alert is working:</p>
  
  <pre><code>function RequestNext() {
  
      var xhr = getXMLHttpRequest();
  
      xhr.onreadystatechange = function() {
  
          if (xhr.readyState == 4 &amp;&amp; (xhr.status == 200 || xhr.status == 0)) {
              MyCard = GetCard(xhr.responseText);
              **alert(MyCard.GetNo());**
              return MyCard;
          }
      };
  
      xhr.open("GET", "../../HttpRequest_Next.php" , true);
  
      xhr.send(null);                                             
  }
  </code></pre>
  
  <p>Then I have this other function where the first one gets called and the same alert does not work:</p>
  
  <pre><code>function Start(){
  
      var MyCard = RequestNext();
  
      alert("Patience.js");
      **alert(MyCard.GetNo());**
      alert("test2");
      //alert(Card.GetKind());
      //WriteCard(Card);
      alert("test3");
  }
  </code></pre>
  
  <p>For information, those functions are in 2 files.</p>