import
为什么我的函数返回“ unifned”?我函数中的function getZoneNameById(zoneId) {
var zone;
// Send an AJAX request
$.ajax("/riskanalysis/getZoneNameById?id=" + zoneId)
.done(function (zoneName) {
// On success
console.log("Zone name is: " + zoneName);
zone = zoneName;
});
return zone;
}
显示正确的值吗?