Verifying fields in jquery issue

Im trying to verify fields and I keep getting unexpected token { but its an if else and Im not sure what I'm doing wrong. Any help would be great. I'm just learning jquery. Thank you

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;

    }   
}

Answers 1

  • Im trying to verify fields and I keep getting unexpected token {

    You need to put && after &&(phone !== "")

    it should be

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

Related Articles