请问以下的jQuery AJAX请求使用HTTPS,如果原来的网页加载是通过HTTPS?
$。阿贾克斯({
网址:AJAX / test.html的,
成功:功能(数据){警报(数据); }
});
解决方案
是的,使用一个相对URL相对于当前的主机,协议和端口。
Will the following jQuery AJAX request use HTTPS if the original web page load was via HTTPS?
$.ajax({
url: 'ajax/test.html',
success: function(data) { alert(data); }
});
解决方案
Yes, a relative URL works relative to the current host, protocol and port.