jquery ajax发布到非ssl页面,而当前页面是ssl

1 php ajax ssl jquery post

好的,情况:

  • 一个https/ssl页面
  • jQuery的
  • 表单
  • 通过ajax提交给非ssl pagge

没有得到有用的回应

同样的情况,非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!'); }
Run Code Online (Sandbox Code Playgroud)

});

ZZ *_*der 7

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

阅读这篇文章了解更多详情,

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