ajax 非同步載入載入動畫
阿新 • • 發佈:2018-11-17
1.當資料恢復後臺程式碼處理量較大時,希望前臺能夠有個提示或者動畫,讓使用者知道後臺在運轉,讓使用者體驗好點
$.ajax({ url: '${ctx}/admin/course/sysAllContainerToCourse.json', data: param, type: 'post', dataType: 'json', beforeSend: function () { $("body").append('<div id="load" style="position:fixed;top:30%;z-index:1200;background:url(/static/admin/images/loading.gif) top center no-repeat;width:100%;height:140px;margin:auto auto;"></div>'); }, complete: function () { $("#load").remove(); }, success:function(result){ $("#load").remove(); dialogFun('提示資訊', result.message, 5, window.location.href); }, error:function(){ $("#load").remove(); } });
2.效果圖如下,內部的效果自己控制哈:
3.圖片如圖(動圖)