0
我需要使用ExtJS 3.4.0库分配响应值以在JavaScript函数中返回它,函数自然终止而不等待ajax响应,因此count的值始终为零,我需要知道我是否可以这样做,或者如果有替代方案。ExtJS 3.4.0等待Ajax响应
感谢
function test() {
var count = 0;
Ext.Ajax.request({
url: "/Controller/Action",
method: "POST",
success: function(response) {
count = Ext.decode(response.responseText);
}
});
if (count > 1) {
return false;
}
return true;
}
嗨@Riku谢谢您的回答,一路上你所提到的收益只为成功函数但不是函数包装器。 有没有其他想法? – mmuniz
尝试我更新的函数调用 – kuldarim