<script type="text/javascript">
function deactiveItemByID(ID, URL) {
swal({
title: "Are you sure?",
text: "You will not be able to recover this item!",
type: "warning",
showCancelButton: true,
confirmButtonText: "Yes, delete it",
cancelButtonText: "No, cancel",
allowOutsideClick: false,
allowEscapeKey: false,
allowEnterKey: false,
}).then(function (isConfirm) {
if (isConfirm) {
$.post(URL,
{
ID: ID,
},
function (data, status) {
location.reload();
});
}
});
}
</script>
<button onclick="deactiveItemByID('<?php echo $employees->fldUserID; ?>', '<?php echo base_url($deactive_link); ?>');" type="button" class="btn btn-default btn-circle"></button>
model
function deactive_employee() {
$fldUserID = $this->input->post('ID');
$data = array(
'fldUserActive' => '0'
);
$this->db->where('fldUserID',$fldUserID);
if($this->db->update('tblUser', $data)) {
$this->session->set_flashdata('success_msg', 'Employee is deleted');
}
}
controller
how to update the database using jquery respond... it is not displaying any error but also it is not inserting the value in the database Please help me solve my code
</div>