bootstrap的缓存如何处理

小编给大家分享一下bootstrap的缓存如何处理,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!

创新互联公司的客户来自各行各业,为了共同目标,我们在工作上密切配合,从创业型小企业到企事业单位,感谢他们对我们的要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。专业领域包括成都网站设计、网站建设、电商网站开发、微信营销、系统平台开发。

第一步进行新增验证

bootstrap的缓存如何处理

第二步进行修改模态框 验证信息没有消除 且表单数据被缓存

bootstrap的缓存如何处理

模态框代码:新增修改共用一个模态框

<!-- 模态框(Modal) -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h5 class="modal-title" id="myModalLabel">
标题
</h5>
</div>
<div class="modal-body">
<form id="form1" class="form-horizontal" role="form">
<input type="hidden" id="unitId" name="unitId"/>
<div class="form-group">
<label class="control-label col-sm-2" for="">单位名称</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="unitName" name="unitName">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" >关闭</button>
<button type="button" class="btn btn-primary" onclick="save()">提交</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>

js代码  

//验证设置
 
$(function(){
$("#form1").bootstrapValidator({
feedbackIcons: {
 valid:"glyphicon glyphicon-ok",
 invalid:"glyphicon glyphicon-remove",
 validating:"glyphicon glyphicon-refresh"
 },
fields : {
"unitName" : {
 
validators : {
notEmpty : {
message : '单位名称不能为空'
}
}
}
}
});
});
 
  //重置表单数据
$(function() {
 $("#myModal").on('hide.bs.modal',function() {
 //关闭后重置表单数据
 $("#form1").data('bootstrapValidator').resetForm();
 
 
 });
  
 $("#myModal").on('show.bs.modal',function() {
 //打开前重置表单数据
 $("#form1").data('bootstrapValidator').resetForm();
 });
});
function save() {
 
  //保存前开启验证
$("#form1").bootstrapValidator("validate");
if($("#form1").data("bootstrapValidator").isValid()){
$.ajax({
url : "${path}/center/unit/save.action",
data : $('#form1').serialize(),
type : "post",
dataType : "json",
beforeSend : function() {
// loading show
},
success : function(result) {
if (result.success) {
search();
alert(result.message);
 
     //关闭模态框
$('#myModal').modal('hide');
} else {
alert(result.message);
}
},
complete : function() {
},
error : function(data) {
alert("error");
}
});
}}

最终解决效果

bootstrap的缓存如何处理

bootstrap的缓存如何处理

看完了这篇文章,相信你对bootstrap的缓存如何处理有了一定的了解,想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!

网页题目:bootstrap的缓存如何处理
文章URL:https://www.cdcxhl.com/article8/gcpdop.html

成都网站建设公司_创新互联,为您提供移动网站建设建站公司网站导航动态网站用户体验

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

手机网站建设