Suppose there is a chat, it is a table of ten lines: the ten last posts of users. Below is a form for a new message. I can use jquery without reloading the page to add the entered messages to the database, but how to update the message table? Does this procedure make sense or is it better to reload the page when the "submit" button is called?

    1 answer 1

    So you do not solve the problem. =) Campaign you need to read about AJAX more closely. That was the question already. Here is another one .

    Dig in the direction of the comet. Here is a good little article someone from the local recommended. I like it. =)

    • Yes, and the direct answer to the reboot question. Definitely chat should be on ajax'e. That is, you upload new messages after they appear in the database (this is the complexity). You have ajax function with callback (in general, all jquery functions have callback). That is what is executed when the request is successful-unsuccessful. And then again send a request to the ayak, and get the latest messages. In general, it is better to do so. Send a post-request on AYAKS, and there if everything is OK, return the latest messages and process them in the callback function - stasych
    • Thanks for the tip about Comet, the first time I hear about this thing, I will try to learn. - olegmar