I think the below problem is scope related but I'm not very good with jQuery plugin pattern, how can I solve it ?
Details
I'm trying to fix an issue (Cross Domain) with this chrome extension 
I think I found a solution ( using anyorigin.com ) but I got an new  problem with the $.getJSON:
Uncaught ReferenceError: jQuery19109374020271279013_1462700430014 is not defined:
?url=https%3A//thepiratebay.cr/search/I%20Will%20Survive%201999/0/7/0&callback=jQuery19109374020271…:1 Uncaught ReferenceError: jQuery19109374020271279013_1462700430016 is not defined(anonymous function) @ ?url=https%3A//thepiratebay.cr/search/I%20Will%20Survive%201999/0/7/0&callback=jQuery19109374020271…:1
Here the code involved doSearch() is where I go the issue:
    (function($) {
        $.fn.extend({
            tpbSearch : function(options){
                var defaults = { searchTerm: ''};
                var options = $.extend(defaults, options);
                return this.each(function(){
                    doSearch($(this), options.searchTerm);
                })
            }
        });
        // private functions
        // ....
        function buildSearchUrl(searchTerm)
        {
            var searchPart = 'https://thepiratebay.cr/search/' + encodeURIComponent(searchTerm) + '/0/7/0';
            var searchUrl = 'http://anyorigin.com/get?url=' +  escape(searchPart) + '&callback=?';
            return searchUrl;
        }
        // function where the issue happens.
       function doSearch(container, searchTerm){
            // here we should iterate over the container selector, because it's possible multiple items will be selected.
            var sanitizedSearchTerm = sanitizeSearchTerm(searchTerm);
            // set the default logo
            var loadingImageUrl = chrome.extension.getURL('images/ajax-loader.gif');
            var logo = $('<img id="tpb-logo">')
                        .attr('src', loadingImageUrl)
                        .css('width', '25px')
                        .css('height', '25px');
            container.children().remove();
            container.append(logo);
            var searchUrl = buildSearchUrl(sanitizedSearchTerm);
            $.getJSON(searchUrl, function(data){
                alert('aa');
            });
        }
}(jQuery));
 
     
    