核心提示:如何防止表单重复提交? $.ajax({type:POST,url:${ctx}/sku/saveMultiSpe,data:{specificationName:specificationName,...
如何防止表单重复提交?
$.ajax({ type:"POST", url:"${ctx}/sku/saveMultiSpe", data:{ specificationName:specificationName, classifyId:classifyId, multiSpeId:multiSpeId, }, beforeSend: function () { // 禁用按钮防止重复提交 $("#bannerSummitOK").attr({ disabled: "disabled" }); $("#bannerSummitOK").css("background","#777"); }, success:function(data){ if(data=="SUCCESS"){ alert("保存成功"); location.href="${ctx}/sku/index?"; }else if(data=="DATAEXIST"){ alert("该分类下的数据已存在"); location.href="${ctx}/sku/index?"; }else{ alert("保存失败"); } }, error:function(data){ alert("保存出错"); }, complete: function () { $("#bannerSummitOK").removeAttr("disabled"); $("#bannerSummitOK").css("background","#3071a9"); }, });