我致力于将按钮与将输入提交到后端的函数绑定我有一个html文件,我在其中声明了file.js,其中实现我的代码的逻辑如下:
$(document).ready(function(){
console.log("1");
$(function() {
FastClick.load(document.body);
console.log("1");
});
$('.containerHeader').on('click',function(){
$that = $(this);
$that.parent().toggleClass('active');
console.log("2");
});
$('#contact-form').bind('submit',function( event, submit ){
var quizAnswer= {};
event.preventDefault();
quizAnswer.aa= $('#big-data-form').find('input:radio[name="cc-radio-group"]:checked').val();
quizAnswer.bb= $('#social-form').find('input:radio[name="ss-radio-group"]:checked').val();
quizAnswer.cc= $('#cloud-form').find('input:radio[name="ww-radio-group"]:checked').val();
quizAnswer.dd= $('#mobile-form').find('input:radio[name="tt-radio-group"]:checked').val();
console.log("3");
var contactForm = $("#contact-form");
var contactInfo = {};
contactInfo.firstName = contactForm.find('input[name="first-name-input"]').val();
contactInfo.lastName = contactForm.find('input[name="last-name-input"]').val();
contactInfo.phone = contactForm.find('input[name="phone-input"]').val();
contactInfo.email = contactForm.find('input[name="email-input"]').val();
contactInfo.company = contactForm.find('input[name="company-input"]').val();
console.log("4");
submitToBackend(contactInfo,quizAnswer);
console.log("5");
});