Showing
1 changed file
with
29 additions
and
16 deletions
@@ -17,7 +17,7 @@ $sc.click(function() { | @@ -17,7 +17,7 @@ $sc.click(function() { | ||
17 | $.post('/passport/back/sendbackmobile', { | 17 | $.post('/passport/back/sendbackmobile', { |
18 | mobile: $('#mobile').val(), | 18 | mobile: $('#mobile').val(), |
19 | area: $('#area').val(), | 19 | area: $('#area').val(), |
20 | - verifyCode: $('#captchaPic').val(), | 20 | + verifyCode: $('#captchaPic').val() |
21 | }, function(jsonData) { | 21 | }, function(jsonData) { |
22 | if (jsonData.code === 200) { | 22 | if (jsonData.code === 200) { |
23 | $errTip.hide(); | 23 | $errTip.hide(); |
@@ -71,17 +71,33 @@ itime = setInterval(function() { | @@ -71,17 +71,33 @@ itime = setInterval(function() { | ||
71 | 71 | ||
72 | 72 | ||
73 | $('#captcha').keyup(function() { | 73 | $('#captcha').keyup(function() { |
74 | - var v = $.trim($(this).val()); | ||
75 | - | ||
76 | - if (v !== '') { | ||
77 | - | ||
78 | - //添加验证码正确验证 | ||
79 | - //$next.removeClass('disable').prop('disabled', false); | ||
80 | - $next.removeClass('disable').removeAttr('disabled'); | ||
81 | - } else { | ||
82 | - | ||
83 | - //$next.addClass('disable').prop('disabled', true); | ||
84 | - $next.addClass('disable').attr('disabled', true); | 74 | + var v = $.trim($(this).val()), |
75 | + that = this; | ||
76 | + | ||
77 | + if (v.length === 4) { | ||
78 | + $.ajax({ | ||
79 | + type: 'POST', | ||
80 | + url: '/passport/back/backmobile', | ||
81 | + dataType: 'json', | ||
82 | + data: { | ||
83 | + verifyCode: $('#captcha').val(), | ||
84 | + area: $('#area').val(), | ||
85 | + mobile: $('#mobile').val() | ||
86 | + }, | ||
87 | + success: function(res) { | ||
88 | + if (res.code === 200) { | ||
89 | + | ||
90 | + //添加验证码正确验证 | ||
91 | + $next.removeClass('disable').removeAttr('disabled'); | ||
92 | + $errTip.addClass('hide'); | ||
93 | + $(that).removeClass('error'); | ||
94 | + } else { | ||
95 | + $next.addClass('disable').attr('disabled', true); | ||
96 | + $errTip.removeClass('hide').find('em').text('验证码输入错误'); | ||
97 | + $(that).addClass('error'); | ||
98 | + } | ||
99 | + } | ||
100 | + }); | ||
85 | } | 101 | } |
86 | }).blur(function() { | 102 | }).blur(function() { |
87 | var v = $.trim($(this).val()); | 103 | var v = $.trim($(this).val()); |
@@ -90,10 +106,7 @@ $('#captcha').keyup(function() { | @@ -90,10 +106,7 @@ $('#captcha').keyup(function() { | ||
90 | 106 | ||
91 | //添加验证码正确验证 | 107 | //添加验证码正确验证 |
92 | $(this).addClass('error'); | 108 | $(this).addClass('error'); |
93 | - $errTip.removeClass('hide'); | ||
94 | - } else { | ||
95 | - $(this).removeClass('error'); | ||
96 | - $errTip.addClass('hide'); | 109 | + $errTip.removeClass('hide').text('请输入验证码'); |
97 | } | 110 | } |
98 | }).focus(function() { | 111 | }).focus(function() { |
99 | $(this).removeClass('error'); | 112 | $(this).removeClass('error'); |
-
Please register or login to post a comment