I'm using admin template from themeforst and now I need to send data into page via ajax. I'm sending all page where is "wysiwyg" editor inside adn when I receive it - it doesn't work for me. So how to parse it correctly?
JS:
function editThis(id) {
$("#failed_msg").fadeOut(100);
$("#success_msg").fadeOut(100);
$.ajax({
url: "admin/news_validation/editNew",
type: 'POST',
dataType: 'JSON',
data: {
new_id: id
},
success: function (data) {
if (data.failed) {
$("#failed_msg").fadeIn(600).find('i').html(data.failed);
} else if (data.success) {
$("#main_block_parsing").fadeOut(600, function () {
$("#main_block_parsing").remove();
$("#edit_new_parsing").fadeIn(800, function () {
$("#edit_new_parsing").html(data.page);
});
});
}
},
error: function (e) {
console.log(e.message);
}
});
PHP:
public function editNew(){
$data = array('id' => $this->input->post('new_id'));
$report = array();
if(!$data['id'] || !is_numeric($data['id']) || $this->news_model->checkNewExsists($data['id']) == FALSE){
$report['errors'] = array('failed' => 'Such new does not exsists');
} else {
ob_start();
$this->load->view('admin/pages/news/edit_new');
$result = ob_get_clean();
$report['errors'] = array('success' => 'The new was parsed successfully!', 'page' => $result);
}
echo json_encode($report['errors']);
what i should get:
what I actually getting:
in the second photo as you can see the "wysiwyg" is not working