zoukankan      html  css  js  c++  java
  • jquery 封装的ajax调用

    (function(){
        var Ploy = {
            Config: {
                ajaxUrl: "/ajax/ploy.ashx"
            },
            ajax: function(params, callback) {
                var that = this;
                $.ajax({
                    type: "get",
                    cache: false,
                    dataType: "json",
                    url: that.Config.ajaxUrl,
                    data: params,
                    success: arguments[1] || function(){},
                    error: arguments[2] || function(){
                        if (window.console) {
                            console.log("error log: " + data.responseText);
                        }
                    }           
                });
            },
            GetBag: function(){
                var that = this;
                var params = {
                    ajaxMethod: "getbookbag",
                    random: Math.random()
                };
                var suc = function(data){                
                    if(data.isSuccess === 1){
                        Common.ShowMessageGo(data.msg, location.href);
                    } else if(data.isSuccess === -1){
                        Common.login();
                    } else {
                        tar.disabled = false;
                        Common.ShowMessage(data.msg);
                    }
                };
                var err = function(){
                };
                that.ajax(params, suc, err);
            }
        };
        window.Ploy = Ploy;
    })();

  • 相关阅读:
    EXCEL每次打开文件都会出现一个空白sheet1窗口
    Python基础知识之面向对象编程
    Python基础知识之模块详解
    Python基础知识之正则表达式re模块
    Python基础知识之xml模块
    Python基础知识之json&pickle模块
    Python基础知识之装饰器
    VUE-02
    VUE
    虚拟环境的搭建
  • 原文地址:https://www.cnblogs.com/cxlings/p/3454452.html
Copyright © 2011-2022 走看看