1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| var foo = function eliteSubmit(){ $('.page6_form_submit').unbind(); $('.formAlert_p').text('请完整填写:'); var _alert = ""; var isFinish=true; $('.page6_form .inp').each(function(){ if($(this).val()===''){ isFinish=false; var this_pla=$(this).attr('placeholder'); _alert +=$(this).attr('placeholder')+ ","; } }); if(!isFinish){ $('.formAlert_p').append(_alert.substring(0,_alert.length-1)); $('.formAlert').show(); $('.page6_form_submit').bind('click',foo); $('.page6_form_submit').text('立即提交'); }else{ var _data = $('.page6_form').serialize(); console.log('data is : ' + _data); $.ajax({ url:'saveEliteData.action', type:'post', data:_data, dataType:'json', success:function(json){ if(json.success){ mySwiper.removeSlide([0,1,2,3,4]); mySwiper.params.allowSwipeToNext=false; mySwiper.params.allowSwipeToPrev=false; $('.page6_form_submit').bind('click',foo); $('.page7').show(); }else{ $('.page6_form_submit').bind('click',foo); alert(json.msg); $('.page6_form_submit').text('立即提交'); } }, error:function(json){ alert('服务器不稳定!'); $('.page6_form_submit').bind('click',foo); $('.page6_form_submit').text('立即提交'); } }); } }; $('.page6_form_submit').on('click',function(){ console.log(1); $('.page6_form_submit').text('正在提交...'); foo(); });
|