Topic: help regarding to top class coading
hi dear,
i m developing a xajax php web chat application .
my problem is that i want to send message to server side script function by using of array buffer,and callback function .
In my chat script when a user type a message and than hit a send button then it's call a sendMsg function on client side java script function i m trying to send message by buffer array and callback function for in condition :
if user type fast as well as user internet connection is slow.
and my client side java script function for sending message to server side as :
function sendMsg()
{
var user=xajax.$('user').value;
msg=xajax.$('typearea').value;
xajax.$('typearea').value="";
xajax.$('chatarea').value=xajax.$('chatarea').value+user+" says :"+msg+"\r\n";
scrollChatPane();
if (flage)
{
buffermsg.push(msg); // buffmsg is the global array variable
sendMsgBuffer();
}
else
xajax_processChat(user ,msg); // calling a server side xajax function
}
function sendMsgBuffer()
{
flage = true; // global variable
while ( buffermsg[0] != null )
{
xajax_processChat( user , buffermsg[0] );
buffermsg.splice(0,1);
}
flage = false;
}
but i want to change it by callback function with better logic
plz hel me
thanx
Last edited by mics (2008-04-29 8:43:08 PM)