123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- var PublicAction = {
-
- "AjaxSend" :function(e,fnEnd){
- var self = this, result;
-
- var urlstr = window.location.href;
- var searchurl = urlstr.substring(0,urlstr.indexOf('?')+1);
- var matchdata = urlstr.match(/\.com(\/\w+)/)[1];
- var oid = e.CORID,
- url = '/enroll/signup',
- type = "POST",
- async = true;
-
- $('.'+ oid).on('click',function(){
- var that = $(this).parents('form.submit_area');
- var data = {},
- ControlSwitch = true;
- that.find('input').each(function () {
- var name = $(this).attr('name');
- if(typeof name == 'string'){
- var txt = $(this).val();
- var InputName = $(this).attr('name');
- txt = self.FilterHTMLTag(txt);
-
- if(InputName == 'mobile'){
- if(txt != ""){
- if(! self.PhoneVerification(txt)){
-
- $('body .alert-container').remove();
- self.hint('请输入正确的手机号码!');
-
- ControlSwitch = false;
- return false;
- }
- }else {
- $('body .alert-container').remove();
- self.hint('电话号码不能为空!');
-
- ControlSwitch = false;
- return false;
- }
- }
- data[InputName]=txt;
- }
- })
- if(ControlSwitch){
- $.ajax({
- type:type,
- url:url,
- data:data,
- async:async,
- dataType:'json',
- error : function(request) {
-
-
- $('body .alert-container').remove();
- self.hint('未提交成功!');
-
- },
- success : function(data) {
- if(data.code == 200){
- $('body .alert-container').remove();
- $('.submit_area input[name="mobile"]').val("");
-
- fnEnd ? fnEnd() : self.hint(data.msg);
-
- }else if(data.code == 300){
- $('body .alert-container').remove();
-
- fnEnd ? fnEnd() : self.hint(data.msg);
-
- }
- RemoveDiv();
- }
- });
- event.preventDefault();
- return false;
- }
- })
- },
-
-
- "FilterHTMLTag" : function(htmlStr){
- var msg = htmlStr.replace(/<\/?[^>]*>/g, '');
- return msg;
- },
-
-
- "PhoneVerification" : function (tel) {
- var pattern = /(13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}$|170[059]\d{7}$/,
- str = tel;
- return pattern.test(tel);
- },
-
-
- "hint":function(txt){
-
- var M = {};
- if(M.dialog1){
- return M.dialog1.show();
- }
- M.dialog1 = jqueryAlert({
- 'content' : txt,
- 'closeTime' : 2000,
- })
- },
- }
|