ajax 函数回调

var initTaxPriod = function (taxNo) {
intitSearch();
$("#taxPeriod").html("");
taxPeriod.getTaxPeriodWithCallback($("#purchaserTaxNo").val(), getTaxPeriod);
};
=======================================
var getTaxPeriod = function (currPeriod) {
$("#taxPeriod").html(currPeriod.taxPeriod);
};
=======================================
var getTaxPeriodWithCallback = function (taxNo, callback) {
$.ajax({
url: CTX + "/taxPeriod/getTaxPeriod",
type: "GET",
dataType: "json",
data: {'taxNo': taxNo},
cache: false,
success: function (result) {
if (!result.success || !result.data) {
// logger.error("get code error, message=" + result.message);
layer.msg("税款所属期获取失败,请手动刷新", {
icon: 2,
time: 1500, //2秒关闭(如果不配置,默认是3秒)
skin: 'new_icon',
offset: 't',
area: ['auto', '30px'],
anim: 3
});
$(".showTaxPeriod").hide();
$('.refresh_tax').show();
} else if (result.success) {
var taxPeriod = result.data;
// fn.call(this);
if (taxPeriod) {
$(".showTaxPeriod").show();
} else {
$(".showTaxPeriod").hide();
}
callback(taxPeriod);
$(".refresh_tax").hide();
}
}
});
};
原文地址:https://www.cnblogs.com/dand/p/10530728.html