Chat like php and ajax in real time

Asked

Viewed 483 times

-1

I have a chat file. In it is all user conversations. I want that when this file is modified without updating the page, the contents show to the user. It is possible

  • The solution is ajax+setTimeout or even websocket (this depends a lot on the server), if your doubt is wider edit the question with details so that it can be reopened. The answers there should solve your problem of how to use Ajax, which so far seems to be the main problem.

1 answer

1


Yes it is possible through AJAX.

For a simple chat version you can make a block of javascript that makes a request AJAX to X database in X seconds through function setTimeout and only get conversations from a certain date/time. Whenever you get information you add javascript to the chat window. The page php who receives the request and returns the data has to be able to return only the data to a user based on the received parameters.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.