jQuery on() with ajax loaded content
<p>I am trying to 'ajaxify' standard links. I am using the jQuery on() function to intercept the click and retrieve the content dynamically:</p>

<pre><code>$('.nextLink').on("click", function(e) {
    url = $(this).attr( 'href' ).replace( /^#/, '' );
    $.get(url, null, function(response) {
        $('#searchResults').replaceWith(response);
    });
});
</code></pre>

<p>This works fine except that the standard link behavior still occurs so I get the content using ajax but then it's wiped by a full page refresh. I tried returning false from the handler to prevent the normal submit</p>

<pre><code>$('.nextLink').on("click", function(e) {
    ...
    return false;
}
</code></pre>

<p>This works however I also have links in the content which is loaded by ajax. My understanding is that jQuery's on() function should rebind the handlers for content loaded using ajax however it seems adding <code>return false</code> prevents this happening.</p>

<p>So it seems i am in a catch-22 situation, I can either allow the event bubbling to occur which allows 'on()' to work correctly however I also get a non-ajax submit, or I can prevent the standard submit but this breaks <code>on()</code></p>

<p>Can someone tell me the best way to handle this situation?</p>

<p>Many thanks</p>
