title: How to load a page content in variable with jQuery
body: <p>A little problem here.</p>
  
  <p>I'm trying for 2 hours to load/get/steal my own content page in jQuery/JS variable (I'm trying to understand the logic behind the beast).</p>
  
  <p>Now we are, my problem:</p>
  
  <pre><code>$(document).ready(function(){
      var string = $.get( "/main.html", function( data ){
                      return $(data).html();
                  }, "html");
      alert($(string).html());
      document.title = 'Test ~ Main';
      return false;
  });
  </code></pre>
  
  <p>I'm hardly trying to get the content of the main.html page to save it in a variable to permit me to fast load content with .</p>
  
  <p>My main.html page is a simple:</p>
  
  <pre><code>&lt;html&gt;
     &lt;h1&gt;Welcome on main page&lt;/h1&gt;
     &lt;p&gt;Welcome again on main page&lt;/p&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Once i had a null alert and after some modifications i got an Object object. I was google.load() 1.4.1 cause i'm reading a tut on jQuery and i switched to 1 to see if there wasn't an improvement. Before that i catched xmlhttprequest return value ...</p>
  
  <p>So more tests, changements, icecreams and the jQuery.get() doc/manual isn't helping me a lot.</p>
  
  <p>Thank's to all incoming answers.</p>
  
  <p>A french computer science student.</p>
  
  <p>EDIT : There, it is my all script tags -> <a href="http://pastebin.com/pu43wrq2" rel="nofollow">http://pastebin.com/pu43wrq2</a>
  Maybe the problem is inside. And that's to dodge the load("/main.html") that i want to store main.html, work.html and contact.html (once and only once) in an array (for exemple) to fast page switch.</p>