bootstrap中怎么对缓存进行处理

发布时间:2021-07-26 11:43:13 作者:Leah
来源:亿速云 阅读:145

本篇文章给大家分享的是有关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中怎么对缓存进行处理,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注亿速云行业资讯频道。

推荐阅读:
  1. 怎么处理bootstrap的缓存问题
  2. bootstrap的缓存如何处理

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

bootstrap

上一篇:Python正则表达式匹配和提取IP地址的示例分析

下一篇:bootstrap模态框中如何关闭事件

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》