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;
    })();

  • 相关阅读:
    SGU 495 Kids and Prizes 概率DP 或 数学推理
    poj 2799 IP Networks 模拟 位运算
    uva 202 Repeating Decimals 模拟
    poj 3158 Kickdown 字符串匹配?
    uva 1595 Symmetry 暴力
    uva 201 Squares 暴力
    uva 1594 Ducci Sequence 哈希
    uva 1368 DNA Consensus String 字符串
    数字、字符串、列表的常用操作
    if条件判断 流程控制
  • 原文地址:https://www.cnblogs.com/cxlings/p/3454452.html
Copyright © 2011-2022 走看看