欢迎各位兄弟 发布技术文章
这里的技术是共享的
Hey everyone,
I'm writing a new project in Laravel 5 and submitting a form by ajax and I'm using a request to validate the form.
I can't quite figure out how to grab the error message data using javascript if the validation fails. As it mentions in the documentation: "If the incoming request was an ajax request, no redirect will be generated. Instead, an HTTP response with a 422 status code will be returned to the browser containing a JSON representation of the validation errors." -http://laravel.com/docs/5.0/validation#controller-validation
Any ideas how I can get access to the data returned to the browser if a validation error occurred?