I have created a chat website that people can send each other private messages. However, I could not figure out how to detect new entry in a specified text file.
In my website, every user has a text file in their own name and specific url address such as chat.php?name=asd(user's name is asd). tIf other user eners that link and writes something, the new entry writes it in asd.txt without errors. However, the user "asd" is not aware that he has a message. How can i inform him that he has a message. This feature i am trying to add is exactly like facebook informs the users that they have a message to read. Thanks
As Supericy said, you should use AJAX. You should check the place that you display messages out regularly. To do this, you can create a function to get messages and display them. Using setTimeout()
, you can refresh this function. I did a script like that and I used the AJAX method of jQuery and I refreshed this method includes jQuery AJAX by setTimeout()
.