通过JSON发送3个视图时出现以下错误
function BuscarOTPorId(){
if('<?=$this->uri->segment(3);?>'){
$.ajax({
type: "POST",
url: "<?= base_url()?>AgregarOTController/BuscarOTPorId/"+'<?=$this->uri->segment(3);?>',
data: "",
success: function(objView){
}
});
}
}
控制器
public function BuscarOTPorId(){
$id_ot =$this->uri->segment('3');
$getOT =$this->MainModel->BuscarOTPorId($id_ot);
$data = array();
$toJson = array(
'success' => 'true',
'ViewSet' => array(),
'getOT'=>$getOT
);
$toJson['ViewSet']['header'] = $this->load->view('Header/header', $data, true);
$toJson['ViewSet']['leftpanel'] = $this->load->view('leftpanel/leftpanel', $data, true);
$toJson['ViewSet']['create'] = $this->load->view('OT/AgregarOT2', $data, true);
$this->output
->set_content_type('application/json')
->set_output(json_encode($toJson));
}
错误控制台Chrome
资源被解释为文档但使用MIME类型application / json传输:“http://localhost/AgregarOTController/BuscarOTPorId/99”。
答案 0 :(得分:0)
在您的请求标题中,您已发送 Content-Type:text / html ,这意味着您希望将响应解释为HTML。