如何拥有jQueryUI的对话框动态加载内容 [英] How to have jQueryUI dialog box dynamically load content

查看:136
本文介绍了如何拥有jQueryUI的对话框动态加载内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我爱jQueryUI的的对话框。然而,似乎没有一种方法可以动态加载内容内置。我想我必须用一些其他的方法来实现这一目标?只有内部框架加载内容时,他们变得​​可见?这是正确的方式做到这一点?

I love jQueryUI's dialog boxes. However, there doesn't seem to be a way to dynamically load content built-in. I guess I have to use some other approach to achieve this? Will iframes load content only when they're made visible? Is that the right way to do this?

我打开其他对话框的机制,如果他们更适合装载他们第一次打开只有当内容。

I'm open to other dialog box mechanisms if they're more suited for loading the content only when they're first opened.

推荐答案

这是不难做到 - 我不会开始使用内置页框仅此一点搞乱。如何这样的事情?

This isn't hard to do -- I wouldn't start messing with iframes for this alone. How about something like this?

$( ".selector" ).dialog({
   open: function(event, ui) {
     $('#divInDialog').load('test.html', function() {
       alert('Load was performed.');
     });
   }
});

基本上,你创建你的对话框,并在打开时,一个HTML文件是从服务器加载,更换你的&LT的内容; DIV ID =divInDialog>< / DIV&GT ; ,这应该是你的对话框里< D​​IV CLASS =选择/>

Basically, you create your dialog, and when it is opened, an html file is loaded from your server, replacing the contents of your <div id="divInDialog"></div>, which should be inside your dialog <div class="selector"/>.

这篇关于如何拥有jQueryUI的对话框动态加载内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆