AJAX初始化加载内容后的jQuery插件 [英] Initialize the jQuery plugin after AJAX content loads
问题描述
我使用PopEasy jQuery插件,弹出模式窗体。我有工作,如果包含该模式窗体触发环节和DIV是它采用
I'm using the PopEasy jQuery plugin to pop up modal forms. I have it working if the trigger links and the DIV containing the modal form are in the main document which uses
$(document).ready(function(){...
初始化插件。
to initialize the plugin.
不过,我需要触发的内容是通过AJAX加载的模式,这恰好的在的主要文件是准备好了。
But, I need to trigger the modal from content which is loaded via AJAX, which happens after the main document is "ready".
我试过
$(document).ajaxComplete(function(){...
但我可能会使用AJAX在一个稍微不同的方式比方法需要?
but I might be using AJAX in a slightly different way than that method expects?
我怎么能初始化插件的AJAX内容加载后?
How can I initialize the plugin after the AJAX content loads?
推荐答案
您可以在成功回调配置
一旦内容被retreived
You can configure in a success callback
once the content were retreived
$.ajax({
url:"server.aspx",
type:"POST",
success:function(result){
//do it here
}
});
这篇关于AJAX初始化加载内容后的jQuery插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!