我正在尝试验证字段,并且不断收到意外 token {但如果不是,我不确定自己在做什么错。任何帮助都会很棒。我只是在学习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;
}
}
最佳答案
Im trying to verify fields and I keep getting unexpected token {
您需要将
&&
放在&&(phone !== "")
之后它应该是
if ((project !== "") && (example !== "")
&& (location !== "") && (moreinfo !== "") && (email !== "")
&& (dateTime !== "") &&(phone !== "") && ((agree !== "") && (validateEmail(email))){
关于javascript - 验证jQuery问题中的字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36277228/