Last active
August 29, 2015 14:19
-
-
Save farindra/8f00e5f5ec1e879e2147 to your computer and use it in GitHub Desktop.
auto reload div by jquery from php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>auto reload div by jquery from php</title> | |
</head> | |
<body> | |
<center><strong><u>This is Realtime data : </u></strong></br> | |
<div id=content_div_id></div> | |
</center> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script> | |
$(document).ready(function() { | |
$(function() { | |
startRefresh(); | |
}); | |
function startRefresh() { | |
setTimeout(startRefresh,3000); | |
$.get('value.php', function(data) { | |
$('#content_div_id').html(data); | |
}); | |
} | |
}); | |
</script> | |
</body> | |
</html> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get random number | |
echo "Random number: " . (string)(rand(0, 50)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment