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

  • 相关阅读:
    jqGrid api 中文说明
    jsp + js + 前端弹出框
    js中关于带数字类型参数传参丢失首位数字0问题
    java中WGS84坐标(ios)转换BD-09坐标(百度坐标)
    Java中的“浅复制”与“深复制”
    Git错误:error:failed to push some refs to 'git@gitee.com:name/project.git'
    git操作教程
    线程调度及进程调度
    同步锁Lock
    多线程案例
  • 原文地址:https://www.cnblogs.com/cxlings/p/3454452.html
Copyright © 2011-2022 走看看