在jQuery Mobile中打开Popup中的外部页面 [英] Open External Page in Popup in jQuery Mobile

查看:117
本文介绍了在jQuery Mobile中打开Popup中的外部页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery Mobile。其实我想在弹出窗口中打开一个externl链接。
我试过这个。

I'm using jQuery Mobile. Actually i want open an externl link in a popup. I tried this.

<a href="#" id="dialoglink"  data-rel="dialog">Open Dialog</a>
<script>
$(document).delegate('#dialoglink', 'click', function() {
    $(this).simpledialog({
        'mode' : 'blank',
        'prompt': false,
        'forceInput': false,
        'useModal':true,
        'fullHTML' : 
            'http://www.google.com/'
    })
});
</script>

它打开一个弹出窗口,内容是文本 http://www.google.com/
但我真的想加载网址。即google索引页。

It is opening a popup the content is the text http://www.google.com/. But i actually want to load the url. i.e google index page.

推荐答案

您可以使用ajax请求执行此操作:

You can do this with an ajax request:

$.get('http://url.to.load.net',function(data) {
    $(this).simpledialog({
        'mode' : 'blank',
        'prompt': false,
        'forceInput': false,
        'useModal':true,
        'fullHTML' : data
    });  
});

无需推荐,只需使用google.com这样的整个页面即可。 simpledialog无法处理此类内容,它会破坏您的标记结构。但是你可以加载一小段HTML,比如列表视图。

Nothing to recommend though, to do this with a whole page like google.com. simpledialog can't handle this type of content and it would destroy your markup structure. But you can load small pieces of HTML, like a list-view.

这篇关于在jQuery Mobile中打开Popup中的外部页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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