jquery ajax post to non-ssl page while current pag

2019-07-27 03:40发布

Ok, situation:

  • an https / ssl page
  • jquery
  • a form
  • submitted via ajax to a non-ssl pagge

getting no usefull response

the same scenario, non-ssl to non-ssl works perfect.

I can view my console, but cant get any usefull info from it why the request fails...

$.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!'); }

});

1条回答
在下西门庆
2楼-- · 2019-07-27 04:41

You can't make AJAX calls from non-SSL page to a SSL URL. This violates the SOP (Same Origin Policy) because the protocols (HTTP vs HTTPS) are different. Some old browsers don't have this restrictions but all new ones enforce this now.

Read this article for more details,

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

查看更多
登录 后发表回答