title: How to make links in ajax loaded page load other pages?
body: <p>The problem: Links in dynamically loaded pages aren't loading other pages dynamically. </p>
  
  <p>On my index page I have links like the following:</p>
  
  <pre><code>&lt;li&gt;&lt;a class="page_one" title="page_one" href="page_one.html"&gt;Page One&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="page_two" title="page_two" href="page_two.html"&gt;Page Two&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>These dynamically load the content within <code>&lt;div id="guts"&gt;</code> from the external pages into a div with the same id on the index page using the script dynamicpage.js (below), unless javascript is off, then it will simply load the external pages normally. </p>
  
  <p>Here's the javascript:</p>
  
  <pre><code>    $(function() {
  
      var newHash      = "",
          $mainContent = $("#main-content"),
          $pageWrap    = $("#page-wrap"),
          $el;
  
  
  
      $(".dyn").delegate("a", "click", function() {
          window.location.hash = $(this).attr("href");
          return false;
      });
  
      $(window).bind('hashchange', function(){
  
          newHash = window.location.hash.substring(1);
  
          if (newHash) {
              $mainContent
                  .find("#guts")
                  .fadeOut(200, function() {
                      $mainContent.hide().load(newHash + " #guts", function() {
                          $mainContent.fadeIn(200, function() {
                              $pageWrap.animate({
  
                              });
                          });
                          $(".dyn a").removeClass("current");
                          $(".dyn a[href="+newHash+"]").addClass("current");
                      });
                  });
          };
  
      });
  
      $(window).trigger('hashchange');
  
  });
  </code></pre>
  
  <p>The links on the index page are working great but for instance if I wanted to link to page_2.html from the dynamically loaded page_1.html, page_2 is being loaded normally and not updating the url to /#page_2.html</p>
  
  <p>I've tried changing .delegate to .live, but this stops it working altogether. </p>
  
  <p>Could anyone push me in the right direction?</p>
  
  <p>Thanks in advance! </p>