Skip to content

Instantly share code, notes, and snippets.

@gluschenko
Created June 14, 2015 19:16
Show Gist options
  • Save gluschenko/45b41829c3cf4dc6a1df to your computer and use it in GitHub Desktop.
Save gluschenko/45b41829c3cf4dc6a1df to your computer and use it in GitHub Desktop.
function getmess(){
$.ajax({
url:"get_mess.php",
type:"POST",
data:{"id":id},
cahce:false,
timeout:30000,
async:true,
success:function(result){
$("#response").html(result);
setTimeout('getmess()',10000);
}
});
}
на сервере:
while(true){
$a=$_POST["id"];
$find_mess=(mysql_query("SELECT * FROM saymon WHERE id> '$a' "));
if (mysql_num_rows($find_mess)) {
while($row=mysql_fetch_array($find_mess)){
echo $row['mess']."";
}
flush();
exit;
}
sleep(5);
}
mysql_close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment