Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel return validation errors ajax

public function testAjax(Request $request)
  {
    $name = $request->input('name');
    $validator = Validator::make($request->all(), ['name' => 'required']);

    if ($validator->fails()){
        $errors = $validator->errors();
        echo $errors;
    }
    else{
      echo "welcome ". $name;
    }

  }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #return #validation #errors #ajax
ADD COMMENT
Topic
Name
3+3 =