title: Chain jQuery ajax function and normal function in jQuery .net
body: <p>I have a function YR.printGraphs(). This does a number of ajax calls and plots the graphs.</p>
  
  <p>I have to execute some script after completion of all ajax calls but I am unable to do that. I tried the below, also deferred way noting seems working for me.</p>
  
  <p>The function "sangeetha" never fires. What am I doing wrong?</p>
  
  <pre><code>$("#pnlEmail1").ready(function () {
      YR.printGraphs();
  }).sangeetha();
  
  function sangeetha() {
      var s = 0.0;
      $(".printgraphs").each(function () {
          s += parseFloat($(this).height());
      });
  
      s = s - parseFloat($("#pnlEmail1").height());
  
      $(".fulldtls").css({ "top": s + "px", "position": "relative" });
  }
  
  printGraphs: function () {
          ///&lt;summary&gt;Loop through the email metrics available for this customer and makes ajax calls to get the email graph data.&lt;/summary&gt;
          $(".printgraphs").each(function () {
  
              //Every div id is generated with its respective tab name in printreport.cs to distingush graphs.
              // So, check if the div belongs to Email tab, Phone tab or Grades and send the respective tab name to controller to get the correct graph data.
              if ($(this).attr("id").toLowerCase().indexOf("email") &gt;= 0) {
                  YAHOO.Report.changeGraph("Email", $(this), true);
              }
              else if ($(this).attr("id").toLowerCase().indexOf("grade") &gt;= 0) {
                  YAHOO.Report.changeGraph("Grades", $(this), true);
              }
              else {
                  YAHOO.Report.changeGraph("Phone", $(this), true);
              }
          });
       }
  </code></pre>
  
  <p>Every YAHOO.Report.changeGraph makes an ajax call. I heard of function chaining in jQuery but not sure how to apply it in this scenario.</p>