$.ajax({
url: url,
type: method,
enctype: 'multipart/form-data',
data: data,
processData: false,
contentType: false,
cache: false,
success: function(response) {
callback(response);
},
error: function(response) {
$.each(response.responseJSON.errors, function (i, error) {
let el = $(form).find('[name="'+i+'"]');
el.addClass('is-invalid');
el.after($('<div class="invalid-feedback">'+error[0]+'</div>'));
});
}
}
});
form:invalid {
...
}