Javascript 部分

function checkForDefaultAlertPlaceholder() {
if ($("#alertPlaceholder").length == 0) {
$("body > div:nth-child(2)").prepend($('<div id="alertPlaceholder"></div>'));
}
}
bootstrap_alert = function () { }
bootstrap_alert.danger = function (message, timeout, idContainer) {
if (idContainer == null) {
checkForDefaultAlertPlaceholder();
}
var $alert = $('<div class="alert alert-danger alert-dismissable fade in" role="alertdialog"><strong>Error:</strong> ' + message + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button></div>');
$("#" + (idContainer != null ? idContainer : "alertPlaceholder")).append($alert);
if (timeout != null && timeout > 0) {
setTimeout(function () {
$alert.alert("close");
}, timeout);
}
return $alert;
}
bootstrap_alert.warning = function (message, timeout, idContainer) {
if (idContainer == null) {
checkForDefaultAlertPlaceholder();
}
var $alert = $('<div class="alert alert-warning alert-dismissable fade in" role="alertdialog">' + message + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button></div>');
$("#" + (idContainer != null ? idContainer : "alertPlaceholder")).append($alert);
if (timeout != null && timeout > 0) {
setTimeout(function () {
$alert.alert("close");
}, timeout);
}
return $alert;
}
bootstrap_alert.success = function (message, timeout, idContainer) {
if (idContainer == null) {
checkForDefaultAlertPlaceholder();
}
var $alert = $('<div class="alert alert-success alert-dismissable fade in" role="alertdialog"><strong>Success:</strong> ' + message + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button></div>');
$("#" + (idContainer != null ? idContainer : "alertPlaceholder")).append($alert);
if (timeout != null && timeout > 0) {
setTimeout(function () {
$alert.alert("close");
}, timeout);
}
return $alert;
}

将DIV加在表头某处:

<div id="alertPlaceholder"></div>

Ajax调用代码区:

 $('#').click(function(){
$.ajax({
type:'POST',
url:<link>,
data:{},
success:function(data){
bootstrap_alert.success("The data has been saved.", 1000);
},
error:function(data){
bootstrap_alert.danger("Exception!This operation is not performed successfully! Please contact admin!", 1000);
}
}); });

bootstrap 操作提示placeholder的更多相关文章

  1. 小技巧:SystemTray中进行操作提示

    SystemTray中进行操作提示在wp中应用比较广泛,截图如下. 实现方法也十分简单 1.xaml代码中写入: shell:SystemTray.IsVisible="True" ...

  2. AIX-vi操作-提示Unknown terminal type的问题解决方法

    AIX-vi操作-提示Unknown terminal type的问题解决方法AIX Version 5.3$ vi /etc/profilelinux: Unknown terminal type[ ...

  3. Bootstrap -- 插件: 提示工具、弹出框、 警告框消息

    Bootstrap -- 插件: 提示工具.弹出框. 警告框消息 1. 提示工具(Tooltip)插件:根据需求生成内容和标记. 使用提示工具: <!DOCTYPE html> <h ...

  4. wp8.1 app退出操作提示

    微软的wp8.1 sdk相比之前wp8 sdk以及相关dll类库,微软又重新编译过,相关系统类库也经过精简,删改了部分传统dll库中的方法对象,很多常用方法对象被写进Windows.UI为前缀的命名空 ...

  5. eclipse的hadoop插件对集群操作提示org.apache.hadoop.security.AccessControlException:Permission denied

    eclipse的hadoop插件对集群操作提示org.apache.hadoop.security.AccessControlException:Permission denied: user = z ...

  6. Android使用ShowcaseView加入半透明操作提示图片的方法

    http://beeder.me/2014/11/11/how-to-add-a-semi-transparent-demo-screen-using-showcaseview/ 这篇文章具体介绍了如 ...

  7. flutter Tooltip轻量级操作提示

    Tooltip是继承于StatefulWidget的一个Widget,它并不需要调出方法,当用户长按被Tooltip包裹的Widget时,会自动弹出相应的操作提示. import 'package:f ...

  8. 数据库操作提示:Specified key was too long; max key length is 767 bytes

    操作重现: 法1:新建连接——>新建数据库——>右键数据库导入脚本——>提示:Specified key was too long; max key length is 767 by ...

  9. HTML5表单提示placeholder属性兼容IE

    placeholder 属性提供可描述输入字段预期值的提示信息(hint). 该提示会在输入字段为空时显示,并会在字段获得焦点时消失. 注释:placeholder 属性适用于以下的 <inpu ...

随机推荐

  1. python多线程的两种写法

    1.一般多线程 import threading def func(arg): # 获取当前执行该函数的线程的对象 t = threading.current_thread() # 根据当前线程对象获 ...

  2. ionic真机调试Android报错 - could not read ok from ADB Server * failed to start daemon * error: cannot connect to daemon

    在使用真机调试Android程序时,报错如下: could not read ok from ADB Server * failed to start daemon error: cannot con ...

  3. 关于 tf.nn.softmax_cross_entropy_with_logits 及 tf.clip_by_value

    In order to train our model, we need to define what it means for the model to be good. Well, actuall ...

  4. VIM 配置python

    Pre-install sudo yum install automake gcc gcc-c++ kernel-devel cmake sudo yum install python-devel p ...

  5. linux查看某个端口被哪个程序占用

    查看某个端口被哪个程序占用 netstat  -anp  |grep   端口号 查看进程号对应的程序 ps -ef | grep 17997 查看指定端口号的进程情况 netstat -tunlp

  6. s5_day8作业

    # 1 整理今天装饰器代码(每人手写一份,注意,是手写,交到小组长手里,明天我检查),准备明天默写 # 2 编写日志装饰器,实现功能如:一旦函数f1执行,则将消息2017-07-21 11:12:11 ...

  7. js踩过的一些坑

    参考我的博客:http://www.isedwardtang.com/2017/08/29/js-bug/

  8. Linux安全策略配置-pam_tally2身份验证模块

    PAM身份验证安全配置实例 - 强制使用强密码(用户密码安全配置) - 用户SSH登录失败尝试次数超出限制后锁定账户(帐户锁定/解锁和时间设置) - 允许普通用户使用sudo而不是su(限制普通用户登 ...

  9. Python3:自动发送账单邮件

    Python3:自动发送账单邮件 一.前言 民间借贷,没有信用卡那样,每月会收到账单:为了民间借贷管理更加合理化,写了个还款账单小程序. 二.源码 (1)配置文件代码: [dbmysql] ip = ...

  10. dubbo应用

    一.安装配置 cd /usr/local/ wget http://www.apache.org/dist/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar. ...