ajax 模板

发表于 2016-12-06 14:12:01   |   下载附件   |   字体:
ajax
$.ajax({
    cache:false,
    type:"post",
    url:"",
    data:{},
    dataType:"json",
    success:function(data){

    },
    error:function(){}
});


$.when($.ajax({
            cache:false,
            type:"get",
            url:config.domain + 'api/lottery/merchant/mine/wallet/BankCardInfo.do',
            data:{
                merchantId:config.merchantId
            },
            dataType:"json",
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true
        }), $.ajax({
            cache:false,
            type:"get",
            url:config.domain + 'api/lottery/merchant/mine/wallet/MyWallet.do',
            data:{
                merchantId:config.merchantId
            },
            dataType:"json",
            xhrFields: {
                withCredentials: true
            },
            crossDomain: true
        }).done(function (data1,data2) {
			alert("成功获取数据");
		}).fail(function () {
			alert("程序出现错误!");
		}).then(function (data1,data2) {
			alert("程序执行完成");
		});