title: Jquery - $.When not trigger ajax on done menthod
body: <p>Was try to implement another ajax call based on the first two results with Jquery $.When method. Basically, all three Ajax will populate a carousel on the page based on the results. Therefore I choose $.When for continuous checking.  But the third Ajax which under Done() method is not called even there was no result from above two APIs or with initial values zero(0). Not sure if I missed anything!</p>
  <p><strong>jQuery:</strong></p>
  <pre><code>let itemCat1Count = 0;
  let itemCat2Count = 0;
  
  $.when(
      $.ajax({
          url: &quot;/webmethod/GetItemsCatOne&quot;,
          type: &quot;POST&quot;,
          data: '',
          dataType: &quot;json&quot;,
          contentType: &quot;application/json; charset=utf-8&quot;,
          success: function (data) {
              if (typeof (data.ResponseObject) !== undefined &amp;&amp; data.ResponseObject !== null) {
                  itemCat1Count = data.ResponseObject.Items.length;
                  // carousel inital codes
              }
          },
          error: function (jqXHR, status, error) {}
      }),
      $.ajax({
          url: &quot;/webmethod/GetItemsCatTwo&quot;,
          type: &quot;POST&quot;,
          data: '',
          dataType: &quot;json&quot;,
          contentType: &quot;application/json; charset=utf-8&quot;,
          success: function (data) {
              if (typeof (data.ResponseObject) !== undefined &amp;&amp; data.ResponseObject !== null) {
                  itemCat2Count = data.ResponseObject.Items.length;
                  // carousel inital codes
              }
          },
          error: function (jqXHR, status, error) {}
      }),
  ).done(function (xhrSavedRings, xhrShoppingBagItems) {
      if (itemCat1Count == 0 &amp;&amp; itemCat2Count == 0) {
          $.ajax({
              url: &quot;/webmethod/GetItemsSpecial&quot;,
              type: &quot;GET&quot;,
              dataType: &quot;json&quot;,
              contentType: &quot;application/json; charset=utf-8&quot;,
              success: function (jObject) {
                  console.log(jObject);
                  // carousel inital codes
              },
              error: function (jqXHR, status, error) {}
          });
      }
  });
  </code></pre>