我准备好了我的联系表格,但出于某种原因,当我用uglify吞下它时,它会返回一个错误并且不会缩小。我的javascript看起来是正确的,当我删除ajax调用但是随着ajax调用它会中断时它会崩溃。任何见解?这是我的js:
$('.contact-form').on('valid.fndtn.abide', function() {
var name = $(".contact-form input#name").val();
var email = $(".contact-form input#email").val();
var message = $(".contact-form textarea#message").val;
// Data for response
var dataString = 'name=' + name +
'& email =' + email +
'& message =' + message;
//Begin Ajax Call
$.ajax({
type: "POST",
url: "php/mail.php",
data: dataString,
success: function() {
$('.contact-form').html("<div id ='success'></div>");
$('#success').html("<h2>Thanks!</h2>")
.append("<p>Dear" + name + "!, I look forward to working with you.</p>")
.hide()
.fadeIn(1500);
},
}); //ajax call
return false;
});
答案 0 :(得分:0)
JsLint在此代码上抛出错误。删除尾随的逗号似乎清除了它:
.fadeIn(1500);
}, /* <-- remove this comma */