我试图验证字段并且我不断获得意外令牌{但它是一个if else而且我不确定我做错了什么。任何帮助都会很棒。我只是在学习jquery。谢谢
if ((project !== "") && (example !== "")
&& (location !== "") && (moreinfo !== "") && (email !== "")
&& (dateTime !== "") &&(phone !== "") ((agree !== "") && (validateEmail(email))){ //here!
$.ajax({
url: "website url",
data: { "entry123": allvariables above
},
type: "POST",
dataType: "xml",
statusCode: {
0: function () {
window.location.replace("index.html");
},
200: function () {
window.location.replace("thanks.html");
}
}
});
} else {
console.error(error)
var error = error;
}
}
答案 0 :(得分:0)
我正在尝试验证字段,并且我不断收到意外的令牌{
您需要在&&
&&(phone !== "")
应该是
if ((project !== "") && (example !== "")
&& (location !== "") && (moreinfo !== "") && (email !== "")
&& (dateTime !== "") &&(phone !== "") && ((agree !== "") && (validateEmail(email))){