function getvalue(value) {
document.getElementById('<%= hdnPack.ClientID %>').value = "0";
var stdPack = 0;
alert("a");
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "test.aspx/GetStdSellingPack",
data: "{'Col1':'" + value+ "'}",
dataType: "json",
success: function (data) {
alert("b");
if (data != null) {
$(data).each(function () {
var values = data.d;
stdPack = values;
});
}
},
error: function (result) {
alert("Error");
}
});
alert("c");
return stdPack;
}
我试图执行此功能始终返回零,实际上发生了什么警报(a)被解雇,然后警报(C)被解雇然后突然进入警报(b)。结果我想得到的顺序,警报(a)先执行然后警告(b)然后警报(c).Pl给我一个解决方案。谢谢提前