Overriding a jQuery Core function in javascript - getJSON
<p>I am trying to override the <code>getJSON</code> function in jQuery to provide additional params and then call the original <code>getJSON</code>. I am fairly unfamiliar with JavaScript and have scraped this together from other similar examples. Most of the examples I have seen override the behavior from a function in the <code>jQuery.fn</code> namespace. Could someone help me by telling me what I am doing wrong?   </p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript" src="./js/jquery-1.6.4.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;

(function($){    
    var _old = $.getJSON;
    $.getJSON = function(){
        alert("Calling overridden getJSON");    
        return _old.apply(this,arguments);
    };
})(jQuery);

$(document).ready(function() {
    try {
        $(this).getJSON('ajax/test.json', function(data) {
            var items = [];
            alert('done');
        });
    }
    catch (err)
    {
        alert(err.message);
    }
});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
