title: Ajax jquery toggle button
body: <p>Here is the code, I'm using toggle. I want to toggle when the index.php has loaded. In the code below, when I click it opens up and close by itself. I placed the toggle before, and when Click it works BUT for the first time I have to click the button twice.</p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function(){
  
          $("#btn").click(function(){ 
  
              // $("#output").toggle("slow",function(){ // placed before
  
              $("#output").load("index.php",null,function(){ 
  
          $("#output").toggle("slow"); // placed after
  
          })
          }); 
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Note: Index.php files generates a list of links. when I click on the button need it show and hide the list.</p>
  
  <p>I also did load the content first and toggle second, as mentionned In the reply below. But when I click on the button it opens and hides on first click.</p>