我在http://www.tudou.com 这个网站上 打开控制台 输入如下命令:
xhr.open('GET', url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send();
xhr.onreadystatechange = function() {
if (xhr.status === 200) {
alert(200);
}else {
alert(xhr.statusText);
}
}
看到控制台有错误 :XMLHttpRequest cannot load http://saic-sis.escdn.com/api.php?op=get_linkage_xjw&parentid=10000000000004&act=ajax_getlist&keyid=1&callback=cb. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.tudou.com' is therefore not allowed access.
我查了下说是跨域问题, 请问jsop到底是怎么发请求?
$.getJSON()方法我以为是 会创建一个script标签然后掉回调函数,但为什么我的控制台看不到有新增的script标签, 很想知道这个方法大概是怎么跨域。