简体   繁体   中英

multiple forms on one page using bootstrap, ajax and external php

I have these two form that I want to use both on one page without a refresh. The html,validator and the php is working, but it seems to be ignoring this js file to execute the ajax and load messages on the page.How do I write an if statement? Or what are other suggestions to get if one form is filled out to execute this code?

Full Form execution

contact.js File

you are using .on() event onot correctly you have to use it like

$('#contact-form').on('submit', function (e) {

       // your ajax call
}

instead of $('#contact-form').on('#submit', function (e) { }

have a look at your script again.

$(document).on('submit', '#contact-form', function (e) {
e.preventDefault();

       // your ajax call
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM