jQuery的阿贾克斯后,以非SSL页面,而当前页是SSL [英] jquery ajax post to non-ssl page while current page is ssl

查看:78
本文介绍了jQuery的阿贾克斯后,以非SSL页面,而当前页是SSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好了,形势:

  • 在一个HTTPS / SSL页面
  • 的jQuery
  • 表格
  • 通过AJAX到非SSL pagge提交

没有得到有用的回应

相同的情况下,非SSL到非SSL运行完美。

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

});

推荐答案

您将无法从非SSL页面给SSL URL AJAX调用。这违反了SOP(同源策略),因为协议(HTTP VS HTTPS)是不同的。一些旧的浏览器没有这个限制,但所有新的强制执行此了。

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 /谷歌网页工具包-DOC-1-5 /维基/ FAQ_SOP

这篇关于jQuery的阿贾克斯后,以非SSL页面,而当前页是SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆