job.answiz.com
  • 1
Votes
name

So, I have selected a table WHERE status is = 'pending' and I add edit and delete button to each row I want to do is when I clicked the edit button it will automatically update the column status to ='approved'. So basically I want it to update just by clicking the edit button because column status has only 2 values. Pending and Approved.

You can add class to your buttons:

<input type="button" name="del" class="editbtn" value="NO" id="<?php echo $row["id"]; 

and call ajax by class name and get current button id by this.id:

$(".editbtn").click(function(){
    var id = this.id;
    $.ajax({url: "test.php?id="+id, success: function(result){
        $("#div1").html(result);
    }});
});
  • 0
Reply Report