Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel display validation errors ajax


        $validator = Validator::make($request->all(), [
            'barCodeNo' => 'required',
            'propertyNo'  => 'required',
        ]);

        if ($validator->fails()) {

            $response['code']   = 400;
            $response['errors'] = $validator->errors()->toArray();

            return response()->json(['response' => $response],400);
        }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #display #validation #errors #ajax
ADD COMMENT
Topic
Name
3+3 =