第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何通過(guò)ajax提交多步驟表單

如何通過(guò)ajax提交多步驟表單

PHP
子衿沉夜 2022-10-14 09:58:01
我試圖在不刷新頁(yè)面的情況下提交表單,我使用這個(gè)庫(kù)來(lái)執(zhí)行多步表單,但是最后它通過(guò)加載到表單操作來(lái)強(qiáng)制提交表單,我試圖通過(guò)將 form.submit 設(shè)置為來(lái)停止它錯(cuò)誤,但是當(dāng)我這樣做時(shí)它停止發(fā)送請(qǐng)求vai ajax。我的 multstepform.js (function ( $ ) {  $.fn.multiStepForm = function(args) {  if(args === null || typeof args !== 'object' || $.isArray(args))    throw  " : Called with Invalid argument";  var form = this;  var tabs = form.find('.containerformtab');  var steps = form.find('.stepform');  steps.each(function(i, e){    $(e).on('click', function(ev){    });  });  form.navigateTo = function (i) {/*index*/    /*Mark the current section with the class 'current'*/    tabs.removeClass('currentform').eq(i).addClass('currentform');    // Show only the navigation buttons that make sense for the current section:    form.find('.previousform').toggle(i > 0);    atTheEnd = i >= tabs.length - 1;    form.find('.nextform').toggle(!atTheEnd);    // console.log('atTheEnd='+atTheEnd);    form.find('.submitform').toggle(atTheEnd);    fixStepIndicator(curIndex());    return form;  }  function curIndex() {    /*Return the current index by looking at which section has the class 'current'*/    return tabs.index(tabs.filter('.currentform'));  }  function fixStepIndicator(n) {    steps.each(function(i, e){      i == n ? $(e).addClass('activeform') : $(e).removeClass('activeform');    });  }  /* Previous button is easy, just go back */  form.find('.previousform').click(function() {    form.navigateTo(curIndex() - 1);  });  /* Next button goes forward iff current block validates */  form.find('.nextform').click(function() {    if('validations' in args && typeof args.validations === 'object' && !$.isArray(args.validations)){      if(!('noValidate' in args) || (typeof args.noValidate === 'boolean' && !args.noValidate)){        form.validate(args.validations);        if(form.valid() == true){          form.navigateTo(curIndex() + 1);          return true;        }        return false;      }    }    form.navigateTo(curIndex() + 1);  });
查看完整描述

1 回答

?
翻閱古今

TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超5個(gè)贊

使用.submit(或.on)監(jiān)聽(tīng)submitJavaScript 事件。


然后.preventDefault()在事件上取消默認(rèn)行為(提交表單)


$("#myForm").submit(function(e){

    e.preventDefault();

    return false;

});


查看完整回答
反對(duì) 回復(fù) 2022-10-14
  • 1 回答
  • 0 關(guān)注
  • 93 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)