//防止二次提交 var isQuerySmSCodeFlag = false; //请求初始标识 var SmSCodeCount = 0; //发送 function getSmsAuthcode(){ $("#yuyinYzm").hide(); var carId =$('#carId').val(); if ( checkCarId ( carId ) ){ console.info("发送短信第" + (++SmSCodeCount) +"次请求前: " + isQuerySmSCodeFlag + (isQuerySmSCodeFlag == true ? ' 无效请求!':' 有效请求!')); if (!isQuerySmSCodeFlag) { isQuerySmSCodeFlag = true; //请求中 console.info("发送短信第" + (SmSCodeCount) +"次请求中: " + isQuerySmSCodeFlag); $.ajax({ type : "post", url : "cuoche/getCuocheSmsAuthcode.do", data : { "carId" : carId }, dataType : "json", success : function(data) { isQuerySmSCodeFlag = false; //请求结束 console.info("发送短信第" + (SmSCodeCount) +"次请求结束: " + isQuerySmSCodeFlag); var resultCode = data.resultCode; var optionStoreList = data.optionStoreList; if (resultCode == 0){ //发送短信验证码完成,倒计时时长为60s处理开始 top.showMsg("", "短信验证码已发送到客户手机,请注意查收!" , true, "warning"); thisTest(); }else{ top.showMsg("", "获取短信验证码失败,原因:" + data.resultMessage , true, "warning"); } } , error : function(data) { isQuerySmSCodeFlag = false; //请求结束 console.info("发送短信第" + (SmSCodeCount) +"次请求结束: " + isQuerySmSCodeFlag); top.showMsg("", "获取短信验证码失败!", true, "warning"); } }); } } }