[英]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.