位置: IT常识 - 正文

bkuzmic/jquerycrossdomaindataplugin

编辑:rootadmin
bkuzmic/jquery-crossdomain-data-pluginCross Domain Data JQuery Plugin ------------------------------

推荐整理分享bkuzmic/jquerycrossdomaindataplugin,希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!

Cross Domain Data JQuery Plugin ------------------------------- -- by Boris Kuzmic -- version 0.2 -- license: MIT - http://www.opensource.org/licenses/mit-license.php

Plugin can be used to dynamically load content from same or other domains. It can also post form data to remote server script. It’s creating a hidden iframe object to fetch remote page and when remote page sends data (either via window.postMessage in all modern browsers or via window.name in IE 6 & 7), data is read and callback method is invoked.

Simple usage:

Only to retrieve data:

bkuzmic/jquerycrossdomaindataplugin

$.getRemoteData( function(data){ $("body").append( data ); }, 'http://-some-remote-url-/source.html' );

To post form use it like this:

$.postFormRemote( function(data){ $("#form_result").append( data ); }, 'form_id', 'form_url', 'form_method' );

In source page one must add code like this (as last body element), to enable true cross domain interaction:

<script type="text/javascript"> window.name = $("body").html(); try { var target = parent.postMessage ? parent : (parent.document.postMessage ? parent.document : undefined);

if (typeof target != "undefined") { target.postMessage($("body").html(), "*"); } } catch (e) {/**/} </script>

For more info visit wiki:

http://wiki.github.com/bkuzmic/jquery-crossdomain-data-plugin

本文链接地址:https://www.jiuchutong.com/zhishi/313313.html 转载请保留说明!

上一篇:python Unittest的组成(pytest unittest)

下一篇:phpcms如何使用新模板(phpcms建站流程)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络