Jquery and mysql (refresh)
Hi guys,
i would like to check every 5 seconds whether a change in my database has been or not.
Now i have the following code:
- <html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="jquery.fade.js"></script>
<script>
$(document).ready(function() {
$("#mydiv").load("index1.php").css("background-color","white");
var refreshId = setInterval(function() {
$("#mydiv").load('index1.php').vkfade('ff0000','600');
}, 5000);
});
</script>
</head>
<body>
<div id="mydiv"></div>
</body>
</html>
Every 5 seconds index1.php is called and .vkfade will make a red background-color for 600ms:
var refreshId = setInterval(function() { $("#mydiv").load('index1.php').vkfade('ff0000','600'); }, 5000);
The problem is, I would only like to make the background-fade if a change in my database has happened. Now I see the fade even if nothing changed.
Thanks in advance
John