With this code i get each validation error as a single alert:
$.ajax({
type: myMethod,
url: myRoute,
headers: { 'X-CSRF-TOKEN': "{{csrf_token()}}" },
data: form.serializeArray(),
dataType: 'json',
success: function(data){
console.log('validated!');
},
error: function(data) {
var errors = data.responseJSON;
for (error in errors) {
alert(errors[error][0]);
}
console.log(errors);
}
});
So if there are 3 errors user would have to click to close all 3 of them and i would like to alert the error messages in one single alert.
How can i group them?