You can do this:
$.post(url, data, function () {
alert("success");
// Call the custom function here
myFunction();
});
Or this:
// Assign handlers immediately after making the request,
// and remember the jqxhr object for this request
var jqxhr = $.post(url, data);
jqxhr.done(function () {
alert("second success");
// Call the custom function here
myFunction();
});
1
solved jQuery – do something once AJAX complete [duplicate]