I have a code that is working super ok but I don't know how it to put AJAX into it to check if there is one extra result in my table "chat" and if there is it should refresh the page and if the result hasnt changed then not to refresh page , sorry but I have no idea when it comes to ajax.
chat.php
require('checkformessages.php');
...
checkformessages.php
$sqlmessages = mysql_query("SELECT * FROM chat");
$numbermessages = mysql_num_rows($sqlmessages);
AJAX SCRIPT (No IDEA WHAT ITS SUPPOSED TO BE)
if($numbermessages===$ajaxcheck) {
//do nothing
} else {
//it should refresh the chat.php because its required in the page
echo "<script>window.location = window.location.href;</script>";
}
Aucun commentaire:
Enregistrer un commentaire