给大家介绍个跨域访问的Jquery插件jquery.xdomainajax.js
以下是调用方法(注:Jquery部分版本使用该插件无效,现只证明了1.4.1版本有效,1.8.2版本无效)
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery.xdomainajax.js" type="text/javascript"></script>
<script>
//load可以跨域访问
$(document).ready(function () {
$("#content").load("域名");
});
//$.get可以跨域访问
$(document).ready(function () {
$.get('域名', function (res) {
$('#content').html(res.responseText);
});
});
</script>
</head>
<body>
<div id="content">
</div>
</body>
</html>
浙公网安备 33010602011771号