我正在尝试发送电子邮件,代码工作正常这部分应该是点击提交后的回复,但是当我点击提交时,这就是出现的内容
{"nameMessage":"","emailMessage":"","messageMessage":""}
这是无法正常工作的部分
var postdata = $('.contact-form form').serialize();
$.ajax({
type: 'POST',
url: 'sendmail.php',
data: postdata,
dataType: 'json',
success: function(json) {
if(json.nameMessage != '') {
$('.contact-form form .nameLabel').append(' - <span class="violet" style="font-size: 13px; font-style: italic"> ' + json.nameMessage + '</span>');
}
if(json.emailMessage != '') {
$('.contact-form form .emailLabel').append(' - <span class="violet" style="font-size: 13px; font-style: italic"> ' + json.emailMessage + '</span>');
}
if(json.messageMessage != '') {
$('.contact-form form .messageLabel').append(' - <span class="violet" style="font-size: 13px; font-style: italic"> ' + json.messageMessage + '</span>');
}
if(json.nameMessage == '' && json.emailMessage == '' && json.messageMessage == '') {
$('.contact-form form').fadeOut('fast', function() {
$('.contact-form').append('<p><span class="violet">Thanks for contacting us!</span> We will get back to you very soon.</p>');
});
}
}
});
return false;
});
});