更新时间:2022-05-19 19:32:55
您还可以使用 $.ajaxSuccess
:
You can also use $.ajaxSuccess
:
$(document).ajaxComplete(function(ev, jqXhr, options) {
// You could be as specific as you need to here.
if ( options.url.match('second.js') ) {
doSecond();
}
});
或者,您可以在ajaxComplete
内执行此操作:
Alternatively, you could do this inside ajaxComplete
:
$(document).ajaxComplete(function(ev, jqXhr, options) {
// You could simplify to
// doSecond && doSecond()
// if you can trust that it will always be a function
if ( doSecond && $.isFunction(doSecond) ) {
doSecond();
}
});