I made chat, and I am using ajax to refresh messages
function loadlink(){
$('#porukice').load('messages.php',function () {
$(this).unwrap();
});
}
loadlink(); // This will run on page load
setInterval(function(){
loadlink() // this will run after every 5 seconds
}, 2000);
The div
<div id="porukice" style=""></div>
Is moving over a page three times, then it stops but in odd place. The first time element appear on page everything is fine, but after 2 ajax reloads it change place and stops, ajax still works. I really can't figure out why is this happening.
That is how it moves with ajax reload.