Just set the link like this
<a class"setunread" href="#">Set As Unread</a>
And associate it with the click function to send ajax to the server via .class "setunread".
<script type="text/javascript"> $(document).ready(function() { $(function(){ $('.setunread').click(function(){ var message_status=<?php echo $messagecall['message_status'] ;?>; $.ajax({ type: "POST", url: "updatemessages.php?message_status="+message_status, dataType:"json", success: function(datamessage) { } }); return false; }); }); }); </script>
And then in Php you connect to your database and set $_POST['message_status'] and make it protected in the variable when you paste it into the server $status=mysqli_real_escape_string($mysqli,$_POST['message_status']); by setting the status to 0 as invisible, where you see message_status=1 . Obviously, you would add more data to the server-side code (your PHP file) to select an individual message to return to invisible, but if you ask such a question, I would believe that you have some information about how to build on this
I know this is old, but it can help someone to be more clear with such problems.
source share