CodeIgniter Forums

Full Version: validation rule for a json object?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
       $_POST=$this->request->getJSON(true);
       $rules=[
           "name"=>"required",
       ];
       if($this->validate($rules))
           return "ok";
       else
           return "error";
[font=Arial,]always returns false[/font]
And where are you getting the json data from?

Also you should not be assigning it to the $_POST.
(11-19-2020, 04:44 PM)InsiteFX Wrote: [ -> ]And where are you getting the json data from?

Also you should not be assigning it to the $_POST.
I want to confirm requests sent in json
[Image: 123.jpg?t=ol4eo4e4]