CodeIgniter - How to return Json response from controller

后端 未结 4 1221
梦谈多话
梦谈多话 2020-12-05 10:15

How do I return response from the controller back to the Jquery Javascript?

Javascript

$(\'.signinform\').submit(function() { 
   $(this).ajaxSubmit(         


        
4条回答
  •  死守一世寂寞
    2020-12-05 10:28

    return $this->output
                ->set_content_type('application/json')
                ->set_status_header(500)
                ->set_output(json_encode(array(
                        'text' => 'Error 500',
                        'type' => 'danger'
                )));
    

提交回复
热议问题