когда вы используете ajax, laravel автоматически отвечает в JSON за ошибки проверки. поэтому для доступа к ошибкам проверки вы можете использовать this.responseJSON.errors
в разделе ошибок вашего ajax. нет необходимости перезагружать страницу для доступа к ошибкам проверки.
однако в любом случае, если вам нужно перезагрузить или перейти в определенное место, вы можете использовать window.location
window.location.href = "an address"; // going to specific location
window.location.reload(); //reloading the page
Примером ajax является следующий, в котором указан цикл для отображения всех ошибок внутри формы.
$("#form_id").submit(function (e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
var form = $(this);
var url = form.attr('action');
$.ajax({
method: "POST",
url: url,
data: form.serialize(), // serializes the form's elements.
success: function (data) {
// code in the case of success
},
error: function (err) {
if (err.status == 422) { // when status code is 422, it's a validation issue
// code in the case of error
console.log(err.responseJSON);
// you can loop through the errors object and show it to the user
console.warn(err.responseJSON.errors);
// display errors on each form field
$.each(err.responseJSON.errors, function (i, error) {
var el = $(document).find('[name="' + i + '"]');
el.removeClass('is-valid');
el.addClass('is-invalid');
var parent = el.parents('.form-group');
parent.append("<small class='error-message text-right text-danger d-block pr-5 ' role='alert'>" + error + "</small >");
});
}
},
});
});