您的位置:首页 > Web前端 > JavaScript

json跨域

2015-06-20 19:17 555 查看
很有意思的两种连接 ,效果相同。 不同之处: aehyok({"result":"我是远程js带来的数据"});

<script type="text/javascript" src="http://www.yourtour.cc/c.js" ></script>  不能放在fucntion  aehyok 上面,否则失效


<html>
<head>
<title>index.html</title>

<script type="text/javascript">
function aehyok(data)
{
alert(data.result);
}
aehyok({"result":"我是远程js带来的数据"});
</script>
<script type="text/javascript" src="http://www.yourtour.cc/c.js" ></script>
</head>
<body></body>
</html>


<html>
<head>
<title>index.html</title>

<script type="text/javascript">
function aehyok(data)
{
alert(data.result);
}

</script>
<script type="text/javascript" src="http://www.yourtour.cc/c.js" ></script>
</head>
<body></body>
</html>
跨域请求数据


作用,可以实现跨域请求数据
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: