CodeIgniter Forums
show_error() to JSON - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: show_error() to JSON (/showthread.php?tid=68446)



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;