首页IT科技bkuzmic/jquerycrossdomaindataplugin

bkuzmic/jquerycrossdomaindataplugin

时间2025-04-29 03:46:07分类IT科技浏览3115
导读:Cross Domain Data JQuery Plugin...

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:

$.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:

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

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
计算机领域会议时间(计算机与自动化顶会(A类)2023截稿时间及会议时间(持续更新)) 网络营销企业网站优化(怎么优化自己的网站收录和排名呢)