当我尝试更新codeigniter中的内容时,id将被取消定义,仅使用id 1

$('#showdata').on('click', '.item-edit', function(){

            var id = $(this).attr('data');
            $('#update_model').modal('show');
         //s  $('#myform').attr('action', '<?php echo site_url() ?>/Admin/Authorisation/update');
      $.ajax({
             type: 'ajax',
             method: 'get',
             url: '<?php echo site_url() ?>/Admin/Authorisation/edit',
             data: {id: client_id},
             async: false,
            // dataType: 'json',
             success: function(data)
             {

                 alert(id);
                 $('input[name=fname]').val(data.client_fname);
                 $('input[name=lname]').val(data.client_lname);
                 $('input[name=email]').val(data.client_email);
                 $('input[name=phone]').val(data.client_phone);
                 $('input[name=country]').val(data.client_country_id);
                 $('input[name=client_id]').val(data.id);

             }, 

             error: function()
                {
                    alert('could not Edit');
                }

         });    
        });  
            function get_data(){
            $.ajax({
                type: 'ajax',
                url: '<?php echo site_url() ?>/Admin/Authorisation/get_data',
                async: false,
                dataType: 'json',
                success: function(data){
                    var html = '';
                    var i;
                    for(i=0; i<data.length; i++){
                        html +='<tr>'+
                                    '<td>'+data[i].client_id+'</td>'+
                                    '<td>'+data[i].client_fname+'</td>'+
                                    '<td>'+data[i].client_lname+'</td>'+
                                    '<td>'+data[i].client_email+'</td>'+
                                    '<td>'+data[i].client_phone+'</td>'+
                                     '<td>'+data[i].client_country_id+'</td>'+
                                     '<td>' +data[i].password+'</td>'+
                                     '<td>'+data[i].status+'</td>'+
                                    '<td>'+
                                        '<a href="javascript:;" class="btn btn-info item-edit" data="'+data[i].client_id+'">update</a>'+
                                        '<a href="javascript:;" class="btn btn-danger item-delete" data="'+data[i].client_id+'">Delete</a>'+
                                    '</td>'+
                                '</tr>';
                    }
                    $('#showdata').html(html);
                },
                error: function(){
                    alert('Could not get Data from Database');
                }
            });
        }
        });


    </script> 

id is going undefined when i try to update something in codeigniter its taking only id 1. Not gething the correct id. when i alert my id its saying undefined. and in place of id its going null so could not update any thing

the problem is you are getting your id in variable named id, but you are passing it as client_id.

     data: {id: client_id},

this should be data: {id: id},