I will be having a list of messages(as hyperlink) in the ul li design which will represents the messages sent to me. There is a column isread in my database which represents whether I have read my message or not. Now here comes my question.. When user clicks on the messages in that list I want the isread column to be set as 1. Right now I am thinking to fire an ajax request to server to make it 1 when user clicks the link in that list and when I receive response from server I am going to transfer the the user to the location of navigate url present in that list. Am I going right? is there any better approach?
Opening message will take some time. That time will be increased for the time necessary to get response from server. I would open message immediately and then when message is open send notification to the server.
Also add "Make message unread" command.
See Gmail for example.
Maybe you can store the date of visiting, you may need it on the future for statistics, etc. and for making querys= if a row has the "visited" field on null, it has been never visited. Else, it has been visited on the stored date.
Why wait for confirmation of the read-flag change, does it really matter? Presumably you will have to run a query to fetch the message so why not update the flag or increment a view count at the same time?