title: jQuery UI AJAX Tabs - first tab doesn't load
body: <p>I'm using jQuery Tabs to dynamically load results from some calculations with AJAX.  It works fine except that the first (default) tab doesn't hit the server for the results... it caches the first tab's data from the last set of calculations or is blank if this is the first run of the session.  How do I force it to load the default tab from the server?</p>
  
  <p>More detail: I have a jQuery Dialog that basically displays a loading GIF while the server is doing the calculations.  When the result is returned as a JSON object, it checks if the calculation was successful and if so, closes the loading dialog and opens the results dialog.  The first tab either has the old results from the last calculation or is blank if it's the first run when the dialog opens... I know it's not hitting the server for the first tab because the "Net" tab in Firefox's doesn't show any activity when the dialog pops up, but if I change tabs and then back to the first, the AJAX requests show up in the network activity.  I'm using Tomcat for the server if that's important.  </p>
  
  <p>Below is the code.  Thanks for your help!</p>
  
  <p>Javascript:</p>
  
  <pre><code>$(document).ready(function () {
      $("#loading-dialog").dialog({
          autoOpen: false,
          modal: true,
          open: function() {
             $.post("run", {
               var1: whatever, ...
             }).done(function(res) {
                  if( parseInt(res.status) === 0 ) {
                     $("#loading-dialog").dialog("close");
                     $("#results-dialog").dialog("open");
                  } else {
                     alert(res.msg);
                  }
              }).fail(function(xhr, textStatus, errorThrown) {
                  alert('Error: '+xhr.responseText);
              })
           }
      })
      $("#results-dialog").dialog({
          autoOpen: false,
          width: 750,
              open: function () {
                  $("#results-tab").tabs("load", 1); // try to force reloading first tab... doesn't work
              },
          buttons: {
              "OK": function() {
                  $(this).dialog('close');
              }
          }
      });
      $( "#results-tabs" ).tabs({
          beforeLoad: function( event, ui ) {
              ui.jqXHR.error(function() {
              ui.panel.html("Results go here.");
          });
          }
      });
  }); 
  </code></pre>
  
  <p>Relevant HTML bits:</p>
  
  <pre><code>&lt;div id="loading-dialog"&gt;
        &lt;center&gt;Please wait, running model.
        &lt;img src="${pageContext.request.contextPath}/images/loading.gif"&gt;&lt;/center&gt;
  &lt;/div&gt;
  &lt;div id="results-dialog"&gt;
      &lt;div id="results-tabs"&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;a href="result?type=one"&gt;Tab 1&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="result?type=two"&gt;Tab 2&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="result?type=three"&gt;Tab 3&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="result?type=four"&gt;Tab 4&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="result?type=five"&gt;Tab 5&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="result?type=six"&gt;Tab 6&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>