Javascript “Ajax完成事件未命中”;“混合内容”;错误
我正在尝试从HTTPS网站向HTTP端点进行jQueryAjax调用 我收到一个“混合内容”错误: 问题是我对Ajax事件“complete”的回调没有触发,尽管根据jquery页面(): 这是我的密码:Javascript “Ajax完成事件未命中”;“混合内容”;错误,javascript,jquery,ajax,mixed-content,Javascript,Jquery,Ajax,Mixed Content,我正在尝试从HTTPS网站向HTTP端点进行jQueryAjax调用 我收到一个“混合内容”错误: 问题是我对Ajax事件“complete”的回调没有触发,尽管根据jquery页面(): 这是我的密码: $.ajax({ type: "POST", url: url, data: data, complete: function (results) { // Stuff in here is not executed on "Mixed Cont
$.ajax({
type: "POST",
url: url,
data: data,
complete: function (results) {
// Stuff in here is not executed on "Mixed Content" error
}
});
有没有其他方法来捕捉错误?Ajax似乎没有能力
编辑
我知道这个问题:
我的问题不是“为什么会发生错误”,我希望它会发生。我的问题是,既然jQuery的“complete”事件失败,我如何捕获这种类型的错误。您是否尝试过
error()
?是的,但它不起作用。我认为在error()和success()上都会触发complete(),所以看起来ajax自己无法捕捉到这一点。。。你能在一次偶然的机会中重新创建这个问题吗?是的,它非常简单,因为JSFIDLE是一个HTTPS页面。运行fiddle后,检查浏览器控制台以查看错误,但不查看消息。在尝试发出ajax请求之前,您是否尝试过检查http
vshttps
的url,并基本上在它成为错误之前对其进行处理?或者你只是想找到一种不那么“黑”的方式?
complete (Local Event)
This event is called regardless of if the request was successful, or not.
You will always receive a complete callback, even for synchronous requests.
$.ajax({
type: "POST",
url: url,
data: data,
complete: function (results) {
// Stuff in here is not executed on "Mixed Content" error
}
});