Strip all images with data.replace?
<p>I'm using a script to retrieve content from an external website, and the date is returned with certain elements stripped out so that they don't interfere with the page I'm pulling the data to. However, when I view my page with the error console open, I am receiving 404s on all images. Is there anyway I can strip out all the images from the script so that I'm just getting the text (which is still in its formatted tags)?</p>

<pre><code>$(document).ready(function () {
    var container = $('#target');

    function doAjax(url) {
        if (url.match('^http')) {
            $.getJSON("http://query.yahooapis.com/v1/public/yql?" 
            + "q=select%20*%20from%20html%20where%20url%3D%22" 
            + encodeURIComponent(url) 
            + "%22&amp;format=xml'&amp;callback=?", 
            function (data) {
                if (data.results[0]) {
                    var fullResponse = $(filterData(data.results[0])),
                        justTable = fullResponse.find("table");
                    container.append(justTable);
                } else {
                    var errormsg = '&lt;p&gt;Error: could not load the page.&lt;/p&gt;';
                    container.html(errormsg);
                }
            });
        } else {
            $('#target').load(url);
        }
    }
    function filterData(data) {
        data = data.replace(/&lt;?\/body[^&gt;]*&gt;/g, '');
        data = data.replace(/[\r|\n]+/g, '');
        data = data.replace(/&lt;--[\S\s]*?--&gt;/g, '');
        data = data.replace(/&lt;noscript[^&gt;]*&gt;[\S\s]*?&lt;\/noscript&gt;/g, '');
        data = data.replace(/&lt;script[^&gt;]*&gt;[\S\s]*?&lt;\/script&gt;/g, '');
        data = data.replace(/&lt;script.*\/&gt;/, '');
        return data;
    }
    doAjax('mywebsite');
});
</code></pre>
