Filter strings with jQuery/Javascript
<p>Im trying to use $.get to load pages without reloading the page. </p>

<pre><code>&lt;script&gt;
$('#top_links a').click(function (e) {
    e.preventDefault();
    var link = $(this).attr('href');
    $('#content').empty();


    $.get(link, { }, 
        function(data) {
            $('#content').empty().append(data);
        }
    )
});
&lt;/script&gt;
</code></pre>

<p>This works but the entire requested page is getting stuffed into <code>#content</code>. Instead of detecting the ajax request and filtering the data on the server-side, I would like to do it client-side. Is there a way to use javascript to effectively filter the string so that I only get certain divs? The content that I want to preserve will all be contained inside of a div called <code>#content</code> ( Im just trying to swap the current page's <code>#content</code> with the requested page's <code>#content</code>).</p>
