how do i approach this error given in array and i want the error to populate on my Bootstrap alert
Ajax code
$.ajax({
type: type,
url: ajaxurl,
data: formData,
dataType: 'json',
success: function (data) {
if(data.status){
SuccessMessage();
setTimeout(function() {
location.reload();
}, 300);
}
},
error: function (data) {
console.log('Error:', data.responseJSON.errors);
}
});
});
json response
{name: Array(1), email: Array(1), password: Array(1)}
email: ["The email field is required."]
name: ["The name field is required."]
password: ["The password field is required."]
Bootstrap alert:
<div class="alert alert-danger" style="display:none"></div>
2
Answers
Please try it:
With specific columns: