我有一段 javascript 代码,我通过 ajax 调用检索员工列表。
var employees_json = '';
Ajax.callbackAsync('getEmployees', ['2627016'],
function(response){
employees_json = response;
console.log('this: '+ employees_json);
},
function(error){
alert('Error while retrieving employees: '+ error);
}
);
console.log('that: '+ employees_json);
(2627016 是 branch_id)
控制台上的输出:
this: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
that:
为什么employees_json 在ajax 调用之外是空的?
还是我做了一个我看不到的类型!?!