I been working on an ajax chat script which communicates with my database to get the chat logs, but i've got a few questions and hopeing i can get some guidance.
Firstly my script:
Code: Select all
function sendMessage()
{
$.ajax({
type: "POST",
url: "chatpost.php", // php script to insert new message into message table
async: false,
data: "message="+$("#myMessage").val(),
});
$("#myMessage").val("");
return false;
}
function updateShouts(){
$('#chatArea').load('chat.php'); // execute chat.php
}
setInterval( "updateShouts()", 500 ); //call function every half a second
My chat table in database is |RecordID | Message | UserID |
Hope you can help me out
Thanks