$(document).ready(function () {
    var container = $('.blogFeedContainer');
    doAjax('http://www.wtsblog.com/feeds/?' + varRequest);
    function doAjax(url) {
        // if it is an external URI
        if (url.match('^http')) {
            // call YQL
            $.getJSON("http://query.yahooapis.com/v1/public/yql?" +
"q=select%20*%20from%20html%20where%20url%3D%22" +
encodeURIComponent(url) +
"%22&format=xml'&callback=?",
            // this function gets the data from the successful
            // JSON-P call
function (data) {
    if (data.results[0]) {
        var data = filterData(data.results[0]);
        container.html("" + data);
    } else {
        var errormsg = '<p>Error: Could not load feed.</p>';
        container.html(errormsg);
    }
}
);
            // not an external URI, use Ajax load()
        } else {
            //$('#target').load(url);
            container.html(load(url));
        }
    }
    // filter out some nasties
    function filterData(data) {
        // filter all the nasties out
        // no body tags
        data = data.replace(/<?\/body[^>]*>/g, '');
        // no linebreaks
        data = data.replace(/[\r|\n]+/g, '');
        // no comments
        data = data.replace(/<--[\S\s]*?-->/g, '');
        // no noscript blocks
        data = data.replace(/<noscript[^>]*>[\S\s]*?<\/noscript>/g, '');
        // no script blocks
        data = data.replace(/<script[^>]*>[\S\s]*?<\/script>/g, '');
        // no self closing scripts
        data = data.replace(/<script.*\/>/, '');
        // [... add as needed ...]
        return data;
    }
});




