jquery bind second ajax success

I have an ajax request which is showing data on success.
AFTER this is done, I'd like to do something else, the problem is that I can not
touch the ajax code. I could have just done:

$.ajax().success(bla). But I can't touch this code.

I'd have to bind the second function somewhere else and make sure it comes after the first onsuccess. Can it be done?

is there maybe a global event AFTER the success event that I can use?

You should use global events as such, it is called after all AJAX success callback:

$.ajaxSuccess(function(){
//do my global thing here
});

Perhaps ajaxSetup success callback is called at the same time? Didn't test

$.ajaxSetup({
    success: function() {
       // local within the ajaxSetup
    }
});

Why don't you bind the second function to first function

$.ajax().success(bla(new function() {
    //do whatever you want
}));

Here, bla takes a function as a parameter.

Or am I misunderstanding?

The

 complete: function(){
     // Handle the complete event
   }

fires after the success function and is the same as the global

ajaxComplete()

Related Articles
  • I would like to bind .on() to an ajax "event", meaning that I'd like it to be triggered whenever an ajax response is successfully retrieved. I don't get how I could bind .on() to such an event. Do I need to use load like so? $(document).on('load
  • Basic module question here: I can get the global handlers to work fine if I abandon my module pattern, but this test code doesn't work and I'm having great difficulty figuring out why: var MyModule = (function($, my) { $(my).ajaxStart(function() { wi
  • I just discovered there is a Ajax success handler, which is great because its automated! but I'm unsure if it is suitable for my use-case. I'm making many ajax calls and mostly programatically (without user clicks etc) so I don't really want to bind
  • I'm trying to create a global handler that gets called before the ajax success callback. I do a lot of ajax calls with my app, and if it is an error I return a specific structure, so I need to something to run before success runs to check the respons
  • I currently have the jQuery Validation plugin working successfully validating the basics of my form, ie. required fields, email validation, etc; however, I am running an AJAX request on the email field to see if the email is already in use or not. So
  • I have one function which contains child functions and objects: //API load function var apiDataLoader = function () { // Set default settings this.apiSeason = '7924'; this.apiMatchDay = '30'; this.apiType = 'gamelist'; this.apiLink = 'http://example.
  • I'm using knockoutjs and have multiple ajax calls in my project in different script files. I want to streamline the calls into one utility script and I have implemented the following: Script File A: function ABC(){ function myCallbackFunction(result)
  • Consider the following ko bindings on a select element: <select data-bind="value: valueObservable, options: optionsObservableArray, optionsCaption: '[None] - this is an optional field'"> ... given a viewmodel like the following: function M
  • My issue: I have created a JavaScript class that is used by our dev team across our site. It is essentially functionality for a grid/table like structure that allows the user to select items and perform actions on these items with provided action but
You Might Also Like