CodeIgniter Forums
show_error() to JSON - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: show_error() to JSON (/thread-68446.html)



show_error() to JSON - undefined - 07-11-2017

Hi Guys,

Is there any way to get a JSON Version of "show_error" method?

Thanks


RE: show_error() to JSON - Martin7483 - 07-12-2017

Something like this?

PHP Code:
function show_error_json$message )
{
 
   $status = array();
 
   $status["success"] = FALSE;
 
   $status["message"] = $message;

 
   header("Content-Type: application/json");

 
   echo json_encode($status);
 
   exit;