来自 HTTP 页面的 AJAX HTTPS 请求
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1012777/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTTPS request via AJAX from HTTP page
提问by Duncan
Would there be any problems calling an HTTPS page (e.g. a credit card authorisation service i.e. WorldPay) from a standard HTTP page via AJAX?
通过 AJAX 从标准 HTTP 页面调用 HTTPS 页面(例如信用卡授权服务,即 WorldPay)会不会有任何问题?
I can't imagine why there would be a problem, the response would be an HTML page which I could then embed in a result pane or such like?
我无法想象为什么会出现问题,响应将是一个 HTML 页面,然后我可以将其嵌入到结果窗格等中?
采纳答案by AnthonyWJones
Yes this would be a Cross domain posting and would be blocked by the browser.
是的,这将是跨域发布,并且会被浏览器阻止。
回答by ólafur Waage
Anthony is right, but what you could do is create a local page the AJAX calls and that communicates with the HTTPS service via cURL or something else and returns. That way everything is done locally according to Java script.
Anthony 是对的,但您可以做的是创建一个 AJAX 调用的本地页面,该页面通过 cURL 或其他方式与 HTTPS 服务通信并返回。这样,一切都是根据 Java 脚本在本地完成的。

