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

  • Home
  • SEARCH
  • 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 6092253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:25:16+00:00 2026-05-23T12:25:16+00:00

I am trying to override the jQuery ajax function to handle a default action

  • 0

I am trying to override the jQuery ajax function to handle a default action on a success event but also executing the callback function that i am using in the options parameter.
What the purpose is there is tags returning in the response that I always want to strip out of the response for use elsewhere.

The scenario is:

  • Ajax submit
  • Ajax Success
  • –DEFAULT SUCCESS ACTION
  • –Call Ajax Success Callback

Can anyone help?
I have tried extending

  • jQuery.ajax
  • jQuery.ajaxSuccess
  • jQuery.ajax.done

The code I have is:

var _ajaxSuccess = jQuery.fn.ajaxSuccess;  
$.fn.extend({  
    ajaxSuccess: function (a)  
    {  
        _ajaxSuccess.apply(this, a);  
    }  
});
  • 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-23T12:25:17+00:00Added an answer on May 23, 2026 at 12:25 pm

    There is the global ajaxSuccess callback:

    Whenever an Ajax request completes successfully, jQuery triggers the ajaxSuccess event. Any and all handlers that have been registered with the .ajaxSuccess() method are executed at this time.

    That will let you call your own function on every successful AJAX call without interfering with the usual success callbacks.

    There are various other global AJAX event handlers that you might want to look at too.

    If those callbacks don’t have the right timing or capabilities for you, then you could write your own wrapper for $.ajax and use that:

    function wrapped_ajax(options) {
        var success = options.success;
        options.success = function(data, textStatus, jqXHR) {
            // Do whatever needs to be done here.
            if(success)
                success(data, textStatus, jqXHR);
        };
        return $.ajax(options);
    }
    

    You can do whatever you need to the usual success callback parameters before calling the original success callback. You’d call wrapped_ajax in exactly the same way as $.ajax. You could use the same technique to hook into the other callbacks as well.

    • 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 Ant compiler attributes via the command line so that all
I'm trying to create a jQuery plugin, inside I need to do an AJAX
I'm working on a jQuery plugin and can't seem to override the default settings,
I'm trying to call a jQuery popup window function from within an iframe. In
I'm trying to override a property in a base class with a different, but
I am trying to secure a controller action that is being called with the
I have an ajax list that updates (as notifications). However, what I'm trying to
Im trying some ajax call with Struts2 and the JQuery library. This is the
I'm trying to capture a click event that bubbles up the DOM to the
I am trying to override the default behaviour of an anchor tag so i

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.