I am making a chat application with PHP and AJAX and I want to show a message if the user has been on the page for at least 1-2 minutes and hasn’t typed anything in the chat box in the last 1-2 minutes.
I want to show a message in the chat box like in Yahoo: [last message received 2-3 minutes ago]
Use setInterval to periodically run a function that checks the value of the input, and compare it to the previous time you checked (which you would need to store).
If it hasn’t changed, you can use an XHR to tell the server.