<button class="btn btn-sm btn-info" onclick="edit_book1(<?php echo $row['markid'];?>)"><i class="fa fa-search"></i></button>
function edit_book1(markid)
{
save_method = 'update';
$('#form1')[0].reset(); // reset form on modals
//Ajax Load data from ajax
$.ajax({
url : "<?php echo site_url('/Users/ajax_edit')?>/" + markid,
type: "POST",
dataType: "JSON",
success: function(data)
{
$('[name="markid"]').val(data.markid);
// $('[name="sel_ass"]').val(data.ass);
$('#modal_form').modal('show'); // show bootstrap modal when complete loaded
$('.modal-title').text('Upload'); // Set title to Bootstrap modal title
},
error: function (jqXHR, textStatus, errorThrown)
{
alert('Error get data from ajax');
}
});
}
public function ajax_edit1($markid)
{
$data = $this->User_model->get_by_id1($markid);
// $data = $this->User_model->get_by_id1($markid);
echo json_encode($data);
}
public function get_by_id1($markid)
{
$response = array();
$this->db->select('*');
$this->db->from('upload');
$this->db->where ('markid',$markid);
$query = $this->db->get();
return $query->result_array();
}
Error get data from ajax. kindly solve my problem