title: Run two functions with Ajax calls sequentially
body: <p>I have two functions which has <code>ajax calls</code> inside them. </p>
  
  <pre><code>function a(){
      ajaxCall_A();
  }
  function b(){
      ajaxCall_B();
  }
  </code></pre>
  
  <p>And I have another function which calls these two functions in the order of <code>a</code> then <code>b</code>. </p>
  
  <pre><code>function c(){
      a();
      b();
      // expectation : function 'b' will get executed only after function 'a' finished it's execution  
  }
  </code></pre>
  
  <p>I'm not sure whether they are working as I expected or not. Some time it will do but some times it is not. I assume it's because the ajax calls , which are asynchronous , inside them.</p>
  
  <p>How can I run the two functions in function 'c' to achieve the expectation. </p>
  
  <p><strong>NOTE :</strong>  Functions are like below</p>
  
  <pre><code>function a(){ 
      $.ajax({
          url: "url_a",
          type: "post",
          dataType: "html",               
          cache: false,
          success: function(data){             
  
          },
          error:function(){             
  
          }   
      });   
  }
  
  function b(){ 
      $.ajax({
          url: "url_b",
          type: "post",
          dataType: "html",               
          cache: false,
          success: function(data){             
  
          },
          error:function(){             
  
          }   
      });   
  }
  </code></pre>