how to delete records from database with an Ajax

前端 未结 2 1062
一整个雨季
一整个雨季 2021-01-25 00:59

I am using php,mysql and ajax to delete record from a table. The problem is that the in MySQL_query it not getting the id it shows \"id= undefined\", i tried to pass the id to t

相关标签:
2条回答
  • 2021-01-25 01:17
    var rowObj = $(this);    
    $.ajax({
                type: "POST",
                url: "suppliernetwork/delete.php",
                data: "rowid="+arr[1]+"&supplier="+supplier,
                success: function(data){
                     $('.ajax').html($('.ajax input').val());
                     $('.ajax').removeClass('ajax');
                      $(rowObj).parents("tr:first").hide();
                }});
    

    this should hide your complete row.

    0 讨论(0)
  • 2021-01-25 01:21
    <td style="width:62px" class="deletesuppliernetwork '.$rows["id"].'"><img   src="/image/delete.png" style="margin:0 0 0 17px" ></td>     
    

    the index of your ID is 1, that is second index. not 2.

    $.ajax({
            type: "POST",
            url: "suppliernetwork/delete.php",
            data: "rowid="+arr[1]+"&supplier="+supplier,
            success: function(data){
                                                             $('.ajax').html($('.ajax input').val());
                                                             $('.ajax').removeClass('ajax');
                                                        }});
    
    0 讨论(0)
提交回复
热议问题