如何对子域进行 jquery ajax 调用?
我可以调用同一域中的页面,但由于安全问题,当我调用子域中的页面时,它不起作用。 我必须做什么? 帮我!!!
i could call a page inside the same domain, but its not working when i calling a page in a sub domain due to security issues. what i have to do? help me!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以设置 document.domain,但如果我没记错的话,一些浏览器(Opera)甚至不允许这样做。 恐怕您的答案是在您可以通过的子域上创建某种代理
You can set the document.domain but if I remember correctly a few browsers (Opera) will not even allow this. I am afraid your answer is to create some sort of proxy on the subdomain that you can talk through
出于安全原因,大多数浏览器不允许向不同域发送 ajax 请求。 据我所知,你无法做到这一点。
Due to security reasons, most browsers don't allow ajax requests to different domains. So as far as I know, you won't be able to do that.
使用脚本标签,响应应该是 JavaScript 回调。
例如:
而不是:
Do:
将产生以下内容:
Use a script tag and the response should be a javascript callback.
Ex:
Instead of:
Do:
that will result with the following content: