Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<script type="text/javascript" src="[pyt do jquery.js]"></script>
<script language="javascript">
function updateChat() {
$.ajax({
url: 'messages.php',
success: function(result) {
for (var i in result) { // obhojdash vsichki saobshteniq za da gi izvedesh
$('#mydiv').append(result[i].time+' от '+result[i].nickname+': '+result[i].message+'<br />'); // izkarvash saobshteniqta
}
setTimeout('updateChat', 2000); // update-vash pak chata sled 2 sec.
},
dataType: 'json'
});
}
$(document).ready(updateChat);
</script>
<div id="mydiv"></div>