JohnLiu
- 管理员
- 30
- 420
- 2019-07-10
|
1#
t
T
发表于 2020-01-16 12:20
|只看楼主
- $.najax = function (options) {
- var opts = $.extend({
- alerterror: false, alertbierror: false, cache: false, dataType: "json"
- }, options);
- opts.success = function (data) {
- $.loading(false);
- if (options.success) {
- options.success(data);
- }
- }
- opts.error = function () {
- $.loading(false);
- if (options.error) {
- options.error();
- }
- }
- opts.beforeSend = function () {
- $.loading(true);
- };
- opts.complete = function () {
- $.loading(false);
- if (options.complete) {
- options.complete();
- }
- };
- $.ajax(opts);
- }
- //loading效果
- $.loading = function (bool) {
- if (bool) {
- document.getElementById("load").style.display = "";//显示等待效果
- document.getElementById("load").style.cursor = "wait";//鼠标开始等待
- } else {
- document.getElementById("load").style.display = "none";//结束等待效果
- document.getElementById("load").style.cursor = "default";//鼠标停止等待
- }
- }
-
复制代码
|