[英]AJAX doesn't work on https
由于我在Web服务器上使用https,因此具有div的自动刷新功能的AJAX不起作用。 当我使用HTTP时,一切正常。 有人能帮我吗?
这是我正在使用的代码:
<b>
<div id="showMessages">
<script src=http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
function autoRefresh_div() {
$("#showMessages").load("showMessages.php"); // a function which will load data from other file after x seconds
alert("Auto-Refresh works fine");
}
setInterval('autoRefresh_div()', 5000); // refresh div after 5 secs
</script>
<?php include("showMessages.php"); ?>
</div>
</b><br>
div也可用。 谢谢大家
我已经解决了这样的问题:
<script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
setInterval(function() {
$("#showMessages").load('showMessages.php')
}, 2000);
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.