Since i'm using https on my webserver, AJAX with an auto-refresh function of a div doesn't work. When I'm using HTTP, everything works fine. Can someone help me?
Here's the code which I'm using:
<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>
The div is also available. Thanks to everybody
I've solved this problem like this:
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.