I can Load data with ajax but, I can't save data with ajax in ckeditor
Here's my ajax in view
$.ajax({
url : "<?php echo base_url('admin/perusahaan_baik/edit_narasi_gcg')?>/" + id,
type: "GET",
dataType: "JSON",
success: function(data)
{
$('[name="id"]').val(data.id);
$('[name="posting_date"]').val(data.posting_date);
$('[name="description"]').val(CKEDITOR.instances.description.setData(data.description));
$('#modal_narasi').modal('show'); // show bootstrap modal when complete loaded $('.modal-title').text('Edit Perusahaan Baik'); // Set title to Bootstrap modal title }, error: function (jqXHR, textStatus, errorThrown) { alert('Error get data from ajax'); } });
Here's my controller
$data = array(
'posting_date' => $this->input->post('posting_date'),
'description' => $this->input->post('description')
);
$this->narasi_model->update_narasi_gcg(array('id' => $this->input->post('id')), $data);
echo json_encode(array("status" => TRUE));
Here's my model
public function get_by_id($id)
{
$this->db->from($this->table);
$this->db->where('id',$id);
$query = $this->db->get();
return $query->row();
}
public function update_narasi_gcg($where, $data)
{
$this->db->update($this->table, $data, $where);
return $this->db->affected_rows();
}
Here's my div
<div class="form-group">
<label class="control-label col-md-3">Posisi ID</label>
<div class="col-md-9">
<textarea name="description" id="description" rows="10" cols="80">
</textarea>
</div>
</div>
print_r($_POST)
in your controller and check what are you getting in post variable. – Naim Malek