下午好,我的JavaScript通话中的数据不可用。
情况1:
function FirstFunction() {
$.ajax({
url: "abc.axd",
cache: false,
dataType: "json",
success: function (resp) {
SecondFunction(resp);
},
error: function () { alert("Error Occured") }
});
}
function SecondFunction(data) {
alert("SecondFunction");
alert(data.responseText);
}
它触发第二个功能,但alert(data.responseText)
始终为undefined
。
情况2:
我尝试了async: false
。
但仍然但alert(data.responseText)
未定义。
情况3:
我也尝试过此问题,但仍然是同一问题,jQuery Ajax导致未定义
有人可以指出我所缺少的吗?
尝试这种方式:
data = JSON.parse(data);
alert(data.IsPackageStillAvailableForSamePrice);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句