title: Wait Ajax finish to do other function
body: <p>I am updating some values in my page using Ajax. And then, after is finishes I need to do other function, using that values.</p>
  
  <p>I am putting one function after the other, but even in that way the second function is not waiting the Ajax to finish.</p>
  
  <pre><code>$(document).ready(function(){
      $(".data").blur(function(){
          var id = $(this).attr('id');
          var value = $(this).html();
          var ad = id.split(';');
  
          Update(valor, id);
          Function2(ad[1]);
  
  
      });
  });
  
  
  function Update(value, id){
      if (window.XMLHttpRequest) {
             // code for IE7+, Firefox, Chrome, Opera, Safari
             xmlhttp=new XMLHttpRequest();
           } else { // code for IE6, IE5
             xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
           }
           xmlhttp.onreadystatechange=function() {
             if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) {
               document.getElementById("div_table").innerHTML=xmlhttp.responseText;
             }
           }
          xmlhttp.open("GET","update.php?value="+value+"&amp;id="+id,true);
          xmlhttp.send();
  
  }
  
  
  function Function2(ad){
      var name_1 = $("#name_1").html(); //This part is updated inside a &lt;span&gt; by the Ajax function
      $('#'+ad).html(name_1);  
  }
  </code></pre>