Javascript 使用JQuery的父到子域AJAX POST请求
首先,我要说的是,我已经花了3天的时间寻找答案,但还没有找到一个有效的解决方案( 我希望能够使用JQuery从Javascript 使用JQuery的父到子域AJAX POST请求,javascript,jquery,ajax,xmlhttprequest,cross-domain,Javascript,Jquery,Ajax,Xmlhttprequest,Cross Domain,首先,我要说的是,我已经花了3天的时间寻找答案,但还没有找到一个有效的解决方案( 我希望能够使用JQuery从www.example.com发布到api.example.com 我已设法使用document.domain和 这一切都是使用SSL保护的 我读过关于使用iFrame在子域上加载页面并使用javascript从父域发布表单的文章,但我真的不想采用这种方法(如果可能的话) 另外,如果跨域发布不可行,那么使用https时,与GET相比,使用POST是否有任何安全优势 谢谢 Jamie如果在
www.example.com
发布到api.example.com
我已设法使用document.domain
和
这一切都是使用SSL保护的
我读过关于使用iFrame在子域上加载页面并使用javascript从父域发布表单的文章,但我真的不想采用这种方法(如果可能的话)
另外,如果跨域发布不可行,那么使用https时,与GET相比,使用POST是否有任何安全优势
谢谢
Jamie如果在主域和子域中设置文档域,则应该能够在两者之间进行Ajax调用 父页面
<script type="text/javascript">
document.domain = "example.com";
</script>
<iframe src="setDocumentDomain.html" style="display:none"></iframe>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
document.domain = "example.com";
</script>
<title>Set Domain</title>
</head>
<body>
</body>
</html>
document.domain=“example.com”;
iframe setDocumentDomain.html代码
<script type="text/javascript">
document.domain = "example.com";
</script>
<iframe src="setDocumentDomain.html" style="display:none"></iframe>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
document.domain = "example.com";
</script>
<title>Set Domain</title>
</head>
<body>
</body>
</html>
document.domain=“example.com”;
集合域
GET请求及其参数可以记录在web服务器的日志中,并通过代理知道该安全点。