单击按钮后如何真正开始加载页面(在 jQuery 模式/对话框窗口中)?
一个以前没有出现过的问题:
单击链接或按钮后,如何开始下载/真正加载 jQuery 模式/对话框窗口内的页面(html 或 php)?
看,目前我相信所有 .load() url 对象都必须位于页面内部,并且 load 实际上只是打开它们,并没有真正开始获取数据。我说得对吗?
我想如果我在模式窗口中放置一个 iframe,也许我可以实现这一点,这样当对话框打开时可能只会加载 iframe 的内容。再说一遍,我非常确定服务器使用 iframe src="page.php" 读取文档,然后加载它们而不显示它......
但我想要的是内容没有加载,然后才单击,它开始从服务器获取文件和图像内容。换句话说:我想要一个老式的小狗窗口,但在很酷的 jQuery / UI 模式/对话框窗口内。
非常感谢您的智慧和帮助。 多年来我一直在实现这一目标 来自荷兰的干杯,萨米
A question that hasn't popped here before:
How to start downloading / truly loading a page (html or php) inside a jQuery modal/dialog window, AFTER a link or button is clicked?
See, currently i blieve that all .load() url objects HAVE to be inside the page and load is actually just opens them, doens't really start fetching data . am i right?
I thought perhaps I could achieve this if i put a iframe in the modal window, that way perhaps only the content of the iframe would be loaded when the dialog opens. then again, im pretty sure that the server reads the document with iframe src="page.php" and just loads them without showing it yet...
But what i want is that the content is NOT loaded, and only then clicked, it starts to get the files and image stuff from server. In other words: i want an old fashioned pup up window, but inside the cool jQuery / UI modal/dialog window.
Thanks so much for your wisdom and help.
Ive been stuck achieveing this for ages
Cheers from Holland, Sammy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还建议阅读一些有关 ajax 原理的内容,但让我尝试回答您的问题,即使您已经这样做了。
对 jQuery.load(...) 的任何调用都必须在页面中的现有元素上完成,比如说一个空的 div 元素。然后,load() 函数通过在后台启动真正的 HTTP GET 请求来异步获取给定 url 的数据,下载返回的任何内容,然后将所有检索到的数据(通常是 html 内容)粘贴到提到的 div 元素中。这会在页面可见时修改页面源,通常称为 ajax。如果粘贴的确实是 html 内容并且包含对图像的引用,则浏览器将识别它并发出更多 GET 请求来加载图像资源,就像在常规 html 页面上完成的那样。
对于一个小型工作示例 请参阅此处,如果我的理解正确,这可能正是您想要实现的目标。
I also suggest to read something 'bout the principles of ajax, but let me try to answer your questions even if you already have done that.
Any calls to jQuery.load(...) have to be done on an existing element in your page, let's say an empty div element. The load() function then asynchronously fetches the data of the given url by starting a real HTTP GET request in the background, downloading whatever is returned and then pasting all retrieved data (usually html content) within the mentioned div element. This modifies the page source while the page is already visible and is commonly referred to as ajax. If it's indeed html content being pasted and it contains references to images, the browser will recognize it and issue more GET request to load the image ressources as it would be done on a regular html page.
For a small working example see here, if I got you right this might be exactly what you want to achieve.