【问题标题】:Verifying fields in jquery issue验证jQuery问题中的字段
【发布时间】:2016-03-29 06:44:03
【问题描述】:

我正在尝试验证字段并且我不断收到意外的令牌 { 但它是一个 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;

    }   
}

【问题讨论】:

    标签: javascript jquery html error-handling syntax-error


    【解决方案1】:

    我正在尝试验证字段,但我不断收到意外令牌 {

    你需要把&&放在&&(phone !== "")之后

    应该是

    if ((project !== "") && (example !== "") 
    && (location !== "") && (moreinfo !== "") && (email !== "") 
    && (dateTime !== "") &&(phone !== "") && ((agree !== "") && (validateEmail(email))){ 
    

    【讨论】:

    • 谢谢,我也没有足够的)最后。感谢帮助的人
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-05
    • 2020-08-02
    • 1970-01-01
    • 2018-01-12
    • 1970-01-01
    • 1970-01-01
    • 2015-11-23
    相关资源
    最近更新 更多