0
我使用themeforst的管理模板,现在我需要通过ajax将数据发送到页面。当我收到它时,我将发送所有的“wysiwyg”编辑器页面 - 它不适用于我。那么如何正确解析它?CodeIgniter - 如何通过ajax传递wysiwyg编辑器
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']);
我应该得到: 我却越来越:
在第二张照片,你可以看到“所见即所得“不起作用