使用jquery对话框时,通过ajax填充时如何调用函数
我正在尝试获取 asmSelect,它本身就可以正常工作:
http:// www.ryancramer.com/projects/asmselect/examples/example1.html
但我现在试图让它在动态填充到 jquery UI 对话框弹出窗口中的页面上工作,但它似乎不是在职的。我基本上是模仿下面的代码并在对话框内渲染部分结果。
http://blog.stevehorn.cc/ 2009/06/rendering-modal-dialog-with-aspnet-mvc.html
我想我的问题是当你通过ajax动态加载东西时,asmSelect中的这段代码似乎不起作用,因为代码不是'还没有。
<script type="text/javascript">
$(document).ready(function() {
$("select[multiple]").asmSelect();
});
</script>
我可以把这个放在哪里?我是否需要将所有 jquery 引用和此代码放入用户控件中?
i am trying to get asmSelect, which works fine on its own:
http://www.ryancramer.com/projects/asmselect/examples/example1.html
but i am now trying to get it to work on a page that get dynamically populated into a jquery UI dialog popup but it doesn't seem to be working. I am basically mimicing the code below and rendering a partialresult inside of a dialog.
http://blog.stevehorn.cc/2009/06/rendering-modal-dialog-with-aspnet-mvc.html
i guess my question is when you are loading stuff dynamically through ajax, this code in asmSelect doesn't seem to work as the code isn't there yet.
<script type="text/javascript">
$(document).ready(function() {
$("select[multiple]").asmSelect();
});
</script>
where can i put this ? do i need to shove all of the jquery references and this code into the usercontrol?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您的代码复制了本教程 ,您需要在
$('#container').append(htmlResult);
调用之后添加.asmSelect()
调用,如下所示(只需获取此处显示的示例):
Since your code copies this tutorial, you would want to add your
.asmSelect()
call after the$('#container').append(htmlResult);
call like this (Just theget
sample shown here):