I have basic codeigniter mvc structure where my form data comes into controller and checks for the validations. i am writing an API to give back the data or to display the errors. what function should i use to get the validation errors in the controller?
$this->validator->getErrors();
This line will give you errors in the JSON format.
Example:
{ "mobile_no": "The mobile_no field is required." }