在事件上运行功能

im trying to run javascript function when other funcion will stop. For example: User change something in form and ajax has been sent in background. When ajax request is done i want to run function.

How can i do that ?

Or maybe there is a global trigger for ajax requests ?

It looks that you are using jQuery, so you can use the "complete" or "success" settings to call code/function. Check the docs.

$.ajax({
    url: "test.html",
    success: function(){
    // call another function
}
});

You could achive that thanks to ajax asynchronous request and handler. If you, for example, call via ajax a page that do a particular function and then return, you can run your js.

Take a look at this: http://api.jquery.com/ajaxComplete/

You can configure a handler for the ajax request which gets called when you get response for the request. You can check the examples at http://api.jquery.com/jQuery.ajax/

If you want to call a specific function for a specific AJAX call, simply call it as part of the success or complete callbacks on that AJAX call. If, however, you want to call the same function whenever any AJAX request is finished, take a look at the .ajaxSuccess() or .ajaxComplete() methods in the jQuery API.