layer載入遮罩層使用 Ajax&nb…
阿新 • • 發佈:2019-01-02
- >
- <</span>html>
- <</span>head>
- <</span>title>Ajax Loading Demo</</span>title>
- <</span>metahttp-equiv="content-type"content="text/html; charset=utf-8"/>
- <</span>styletype="text/css">
- </</span>style>
-
<</span>script
- <</span>scripttype="text/javascript"src="layer/layer.js"></</span>script>
- <</span>scripttype="text/javascript">
- ;!function(){
- layer.config({//載入擴充套件模組
-
extend: 'extend/layer.ext.js'
- });
- layer.ready(function(){
- });
- }();
- function ityzl_SHOW_LOAD_LAYER(){
- return layer.msg('努力中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '0px', time:100000}) ;
- }
-
function ityzl_CLOSE_LOAD_LAYER(index){
- layer.close(index);
- }
- function ityzl_SHOW_TIP_LAYER(){
- layer.msg('恭喜您,載入完成!',{time: 1000,offset: '10px'});
- }
- </</span>script>
- <</span>scripttype="text/javascript">
- $(function(){
- $("#btnRequest").bind("click", function () {
- var i ;
- $.ajax({
- type: "POST",
- dataType: "text",
- url: "admin/index.action",
- beforeSend: function () {
- i = ityzl_SHOW_LOAD_LAYER();
- },
- success: function (msg) {
- ityzl_CLOSE_LOAD_LAYER(i);
- ityzl_SHOW_TIP_LAYER();
- },
- error: function (e, jqxhr, settings, exception) {
- ityzl_CLOSE_LOAD_LAYER(i);
- }
- });
- });
- });
- </</span>script>
- </</span>head>
- <</span>body>
- <</span>ahref=";"id="btnRequest">請求資料</</span>a>
- </</span>body>
- </</span>html>