$("#order").submit(function(e) {
e.preventDefault();
var data = {
name: $("#name").val(),
phone: $("#phone").val(),
address: $("#address").val()
};
if ((data['name'].length > 1) && (data['phone'].length > 1) && (data['address'].length > 1) ) {
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize(),
success: function() {
$('.email-success').delay(500).fadeIn(1000).fadeOut(2000);
$('.email-failed').fadeOut(500);
setTimeout(function(){
$.magnificPopup.close();
$('#orderForm001')[0].reset();
}, 2000);
}
});
} else {
$('.email-failed').delay(500).fadeIn(1000).fadeOut(2000);
$('.email-success').fadeOut(500);
}
return false;
});
<div class="form-item">
<input name="DATA[NAME]" type="text" placeholder="Введите свое имя" id="name">
</div>
<div class="form-item">
<input name="DATA[PHONE_WORK]" type="text" placeholder="Введите свой номер телефона" id="phone">
</div>