Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6782973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:48:30+00:00 2026-05-26T16:48:30+00:00

I am trying to override the getJSON function in jQuery to provide additional params

  • 0

I am trying to override the getJSON function in jQuery to provide additional params and then call the original getJSON. 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 jQuery.fn namespace. Could someone help me by telling me what I am doing wrong?

<html>
<head>
<script type="text/javascript" src="./js/jquery-1.6.4.min.js"></script>
<script type="text/javascript">

(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);
    }
});
</script>
</head>
<body>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:48:30+00:00Added an answer on May 26, 2026 at 4:48 pm

    You need to call $.getJSON, not $(foo).getJSON;

    $.getJSON('ajax/test.json', function(data) {
        var items = [];
        alert('done');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to override a built in parseFloat function in JavaScript . How would
I'm trying to override FOSUserBundle form Edit profile ; I have created the class
I am trying to override the Page_PreInit function inside my class _Default which inherits
I'm trying to override a Devise controller to have some minor changes, for example
I am trying to override one function by replacing it with a different version.
I was trying to override a C-style function ( func ) in a library
I'm trying to override the behavior of an external function in user32.dll because I
I have been trying to override the database method of the loader class (CI_Loader).
I was trying to override the back button functionality where I wanted to call
I am trying to override equals method in Java. I have a class People

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.