we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "laravel return validation errors ajax"
Jasmin
15 Jan 2020
1public function testAjax(Request $request)
2  {
3    $name = $request->input('name');
4    $validator = Validator::make($request->all(), ['name' => 'required']);
5
6    if ($validator->fails()){
7        $errors = $validator->errors();
8        echo $errors;
9    }
10    else{
11      echo "welcome ". $name;
12    }
13
14  }
15
Federico
16 Mar 2018
1@if($errors->any())
2   @foreach ($errors->all() as $error)
3      <div>{{ $error }}</div>
4  @endforeach
5@endif
similar questions
queries leading to this page
laravel return validation errors ajax