jqAjax

 function jqAjax(type, url, dataType, deLoader, fn, d) {   

       var data, flag = false;

       $.ajax({        

         url: url,   

       data: typeof d !== 'undefined' && d[0],     

        //async:false,           

         type: type,          

        dataType: dataType,    

         contentType: typeof d !== 'undefined' && d[1],      

         beforeSend: function () {            

         // if(loadfn) {loadfn();}                 },    

          success: function (d) {            

          data = d;                     if (data.length == 0) { flag = true; }       

          },    

          complete: function (d) {      

               if (deLoader) { deLoader; }            

               if (fn) { fn(data); }         

            return flag;         

  },          

           error: function (e) {     

               console.log('Ins Error At Times!', e);     

            }         

    });

  }

原文地址:https://www.cnblogs.com/ths0201/p/5305038.html