title: Get contents of <body> </body> within a string
body: <p>I want to do the following.</p>
  
  <pre><code>$("a").click(function (event) {
  
      event.preventDefault();
  
      $.get($(this).attr("href"), function(data) {
  
          $("html").html(data);
  
      });
  
  });
  </code></pre>
  
  <p>I want the behavior of all hyperlinks to make a ajax calls and retrieve the html.</p>
  
  <p>Unfortunately you cannot simply replace the current html with the html you receive in the ajax response.</p>
  
  <p>How can grab only what is within the <code>&lt;body&gt; &lt;/body&gt;</code> tags of the ajax response so that i can replace <strong>only</strong> the contents of the body in the existing html.</p>
  
  <p>Edit: the <code>&lt;body&gt;</code> opening tag will not always be just <code>&lt;body&gt;</code> it may sometimes have a class e.g. </p>
  
  <p><code>&lt;body class="class1 class2"&gt;</code></p>