jquery实现告警框(可关闭)
... ... <div class="container"> <div id="myAlert" class="alert alert-success alert-dismissible" role="alert" style="display: none"> <button type="button" class="close">×</button> <strong>成功!</strong> <span id="success"></span> </div> <div id="myAlert2" class="alert alert-danger alert-dismissible" role="alert" style="display: none"> <button type="button" class="close">×</button> <strong style="color: red">错误!</strong> <span id="error"></span> </div> ... ... </div> <!-- /container --> ... ... <script> $(document).ready(function () { $("#about").click(function () { $.getJSON("{{ url_for('init.data') }}", function (data, status) { if (data.status == "ok") { $("#myAlert").show(); $("#success").text(data.message); } else if (data.status == "error") { $("#myAlert2").show(); $("#error").text(data.message); } {#alert("数据: " + data + "\n状态: " + status);#} }); }); $(".close").click(function () { $("#myAlert").hide(); $("#myAlert2").hide(); }) }); </script>
转载请标明出处:http://www.cnblogs.com/duzhaoqi/