bootstrap的缓存怎么处理

发布时间:2022-05-19 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了bootstrap的缓存怎么处理脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

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>
<h4 class="modal-tITle" id="myModalLabel">
标题
</h4>
</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的缓存怎么处理全部内容,希望文章能够帮你解决bootstrap的缓存怎么处理所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:缓存缓存