我已经做出POST调用(带参数)到位于另一台服务器上的ASP形式。
I've to make a POST call(with parameter) to an asp form which is located on another server.
有关的发展,我这样做是在同一台服务器上,它完美的作品,但现在我的另一台服务器,而是收到200状态上测试它,我收到一个0状态。
For development, I did this on the same server, and it works perfectly, but now I'm testing it on another server, and instead of receiving a 200 status, I receive a 0 status.
我想这是因为它是一个跨域AJAX调用,这是它唯一改变的。那么,如何可以做这样的判断?是否有任何文件,我可以把服务器/客户端上,让这个呼叫(如Flash,...)?
I think it's because it's a cross-domain AJAX call, it's the only thing which changed. So how can I make this call? Is there any file I can put on the server/client to allow this call(like flash, ...)?
感谢您!
推荐答案是的,假设你可以连接服务器更改为
Yes, assuming you can change the server you connect to
您可以实现跨地资源共享(CORS)
您需要服务器返回访问控制 - 允许 - 产地:* 如果要允许所有域的访问,否则返回访问 - 控制 - 允许原产地: yourdomain
You need the server to return Access-Control-Allow-Origin: * if you want to allow all domains to access, otherwise return Access-Control-Allow-Origin: yourdomain
如果你不能改变你正在访问的服务器,则需要使用代理脚本来自于服务器上 - 交替进行调查,如果他们发表了一个API返回例如JSONP
If you cannot change the server you are accessing, you need to use a proxy on the server your script comes from - alternatively investigate if they have published an API to return for example JSONP
更多细节在这里
- MDN HTTP访问控制(如何)
- W3Org (Implemation详情)
- MSDN XDR
- MDN HTTP access control (how)
- W3Org (Implemation details)
- MSDN XDR
和几个环节对这一问题的正确
and several links to the right of this questions
更多推荐
跨域AJAX调用后
发布评论