0

I have a simple contact form on my website that I'm hoping to send data with using AJAX/PHP.

When I hit the submit button, I get the error:

Uncaught TypeError: Cannot read property 'mode' of undefined
    at Function.$.ajax (jquery.validate.js:1561)
    at submitForm (form-scripts.js:21)

Line 21 begins below:

Code:

$.ajax({
    type: "POST",
    url: "php/form-process.php",
    data: "name=" + name + "&email=" + email + "&message=" + message,
    success : function(text){
        if (text == "success"){
            formSuccess();
        } else {
            formError();
            submitMSG(false,text);
        }
    }
});

I am using jQuery 3.1.1 (https://code.jquery.com/jquery-3.1.1.slim.min.js) - perhaps this has something to do with it?

Any help would be greatly appreciated.

2

1 Answer 1

4

Your using lite version of jquery which doesn't have jQuery.ajaxPrefilter but it is required by Jquery validate. So use this cdn

Sign up to request clarification or add additional context in comments.

1 Comment

Wow - amazing!!! That was it exactly. I would have bee there all day. Thank you, sir!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.