JavaEar 专注于收集分享传播有价值的技术资料

Error : Resource interpreted as Document but transferred with MIME type application/json:

I get the following error when sending 3 views by JSON

function BuscarOTPorId(){

        if('<?=$this->uri->segment(3);?>'){
            $.ajax({
                type: "POST",
                url: "<?= base_url()?>AgregarOTController/BuscarOTPorId/"+'<?=$this->uri->segment(3);?>',
                data: "",
                success: function(objView){

                }    
            });

    }
}

Controller

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));
}

Error Console Chrome

Resource interpreted as Document but transferred with MIME type application/json: "http://localhost/AgregarOTController/BuscarOTPorId/99".

1个回答

    最佳答案
  1. In your request header, you have sent Content-Type: text/html which means that you'd like to interpret the response as HTML.