Tell me, please, how it is possible to implement the sending of messages, and specifically according to the variant, as in social networks: read by the user or did not read it. If there is any tutorial on this topic, then please drop it. Preferably with jQuery ajax to make it happen. Thank you in advance!

    2 answers 2

    In the database table in which the message is saved, a field is added to store the read status. Accordingly, if the user has opened the message, we consider it read and update the status. In vk.com, a message is considered read if the user starts typing a response or hovers over the message.

    • And how can you do that only when you click on the text of the message was it? Well, the very reading, or at least when you click on the button read? - OverLoader
    • one
      The task is to change the field of the database table from 0 to 1 (or from 1 to 0 - this is an amateur one). And the event that triggers this action, you can choose any. To click on the button there will be something like: $ ("# button"). Click (function () {$ .ajax (/ * send our request to the script with the command for changing the status * /);}); - Indifferent
    • And when opening a message? Or hovering over its cursor, how to do? - OverLoader
    • one
      Open the message - update the status. And hovering the cursor - the mouse * series events will do - Indifferent

    For the table of messages you do the "read" field. When a user uploads messages to himself, that means he received them => mark them as read. jQuery ajax is already a design.