【问题标题】:jquery ajax post to non-ssl page while current page is ssljquery ajax 发布到非 ssl 页面,而当前页面是 ssl
【发布时间】:2010-12-19 22:29:54
【问题描述】:

好的,情况:

  • https/ssl 页面
  • jquery
  • 一个表格
  • 通过 ajax 提交到非 SSL 页面

没有得到有用的回应

同样的场景,非 ssl 到非 ssl 完美。

我可以查看我的控制台,但无法从中获得任何有用的信息,为什么请求失败...

$.ajax({

type: "POST",
url: form.attr("action"),
data: form.serialize(),

error:          function(res){ console.log(res) },
notmodified:    function(res){ console.log(res) },
parsererror:    function(res){ console.log(res) },
timeout:        function(res){ console.log(res) },
success:        function(res){ alert('succes!'); }

});

【问题讨论】:

    标签: php jquery ajax ssl post


    【解决方案1】:

    您不能从非 SSL 页面向 SSL URL 进行 AJAX 调用。这违反了 SOP(同源策略),因为协议(HTTP 与 HTTPS)不同。一些旧浏览器没有此限制,但所有新浏览器现在都执行此限制。

    阅读本文了解更多详情,

    http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/FAQ_SOP

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-10
      • 2012-05-19
      • 2016-03-04
      • 1970-01-01
      • 2014-05-25
      • 1970-01-01
      • 1970-01-01
      • 2012-12-15
      相关资源
      最近更新 更多