jQuery的。对()在阿贾克斯成功 [英] jQuery .on() at ajax success
本文介绍了jQuery的。对()在阿贾克斯成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想结合。对()
来一个Ajax事件,意思是我想它被触发每当一个Ajax响应检索成功。
我不明白我怎么能绑定。对()
这样的事件。我是否需要使用负荷
像这样?
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','#elementInsertedByAjax',function(){
// will do something
});
PS我确实需要使用。对()
因为整个页面由Ajax调用插入。
PS I do need to use .on()
since the whole page is inserted by an ajax call.
推荐答案
您可以使用 .ajaxSuccess()
You can use .ajaxSuccess()
$(document).ajaxSuccess(function() {
// will do something
});
或绑定到
$(document).on('ajaxSuccess','#elementInsertedByAjax',function(){
// will do something
});
这篇关于jQuery的。对()在阿贾克斯成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文