title: jquery/ajax general question about limits and cache management
body: <p>I'm trying to renew my company intranet using jquery, ajax and php. General aspect of the site is a drop down menu at the top loaded into a div and a content div where i load pages clicked on drop-down menu. The problem come out when inside content i load a page which inside have a tab menu, what i do when a tab is clicked is to load a html structure page with form and fill it by POST call.</p>
  
  <p>The question is it correct load data when requested instead of pre-load it and show them when called as seen in a lot of example in the web? Working in my way I get a lot of data cached so when i click for confirm some data I send request several data instead of one..
  what is the best way to work with this languages?</p>
  
  <p>I find my goal solution suggested by Nathan I <em>pre-load</em> all data in one time for all forms, here is the code:</p>
  
  <pre><code>$("#div_0").show();
          $("#scheda_eti &gt; div").css({"background-color": "white", "color": "black","cursor":"hand"}); //tabs div
          $("#"+schemi[0]).css({"background-color": "red", "color": "white","cursor":"default"});
          for (var x=0; x&lt;schemi.length; x++)
          {
              $("#div_"+x).load("./schemi/sch_"+schemi[x]+".php", {azione: "vedi"});
          }
          $.post("./php/global.php",
              {azione:"vedi", contratto: $("#suggest_hidden").val() },
              function(xml)
              {
                  if ($("status", xml).text()=="1")
                  {
                      $(xml).find("form").each(function()
                      {
                          var id_form=$(this).attr("id");
                          scorriDati(xml, "form_"+id_form);
                      });
                  }
                  else
                  {
                      $("#scheda_ris").html("&lt;img src='./img/validno.png' alt='errore'&gt; &lt;span style='color:red'&gt;&lt;p&gt;Attenzione!&lt;br&gt;codice non trovato!&lt;/p&gt;&lt;/span&gt;");
                  }
                  $(xml).find("errore").each(function()
                  {
                      $("#scheda_ris").append("&lt;img src='./img/validno.png' alt='errore'&gt; &lt;span style='color:red'&gt;"+$(this).text()+"&lt;br&gt;&lt;/span&gt;\n");
                  });
              },'xml'
          );
  </code></pre>
  
  <p>To see some code you ca watch to my previous posts linked here:
  <a href="https://stackoverflow.com/questions/4808294/jquery-ajax-problem-with-tab-menu">question1</a>
  <a href="https://stackoverflow.com/questions/4831722/jquery-ajax-post-not-append-data-to-form">question2</a></p>
  
  <p>thanks in advance</p>
  
  <p>ciao
  h</p>