• js ajax


    //通用请求入口
    $.extend({
        ajaxReq: function(options){
            var url     = options.url || '';
            var type        = options.type|| 'get';
            var data    = options.data|| {};
            var dataType    = options.dataType || 'json';
            var async       = options.async || true;
            var successFn    = options.succuss || null;    
            var error     = option.error || null;
            var beforeFn    = option.beforeSend || null;
            var complete  = option.complete || null;
            $.ajax({
                url : url,
                type: type,
                data: data,        
                dataType : dataType,
                beforeSend:function(){                
                    if(beforeFn){
                       beforeFn.call(null, Array.prototype.slice.call(arguments));
                    }               
                },        
                complete  :function(){
                    if(complete){
                         complete.apply(null, Array.prototype.slice.call(arguments));
                    }
                },
                success   :function(msg){
                   if(successFn){
                      successFn.call(null, msg);
                   }
                },
                error     :function(){
                   if(error){
                     error.apply(null, Array.prototype.slice.call(arguments));
                   }
                }
               }
            });
        }
    });

  • 相关阅读:
    共享内存
    文件IO函数和标准IO库的区别
    链表程序
    flash_header.S ( freescale imx6 board)
    深入理解二维数组
    putchar和puts
    指针目标
    C语言:break和continue
    C语言:输入输出
    python lambda
  • 原文地址:https://www.cnblogs.com/andydao/p/5076457.html
Copyright © 2020-2023  润新知