【发布时间】:2011-10-18 05:15:30
【问题描述】:
我在使用 $.getJSON 的方法时遇到问题。这很简单,看起来像这样:
function lastID(query) {
$.getJSON(url+query ,function(json){
var type_id = json.data;
});
return type_id // doesn't work
}
您能否告诉我如何将 type_id 返回到其他值,例如:
var returnedID = lastID(query); // this schould me equal to returned type_id from lastID method.
非常感谢您的回复
【问题讨论】:
-
Return value from ajax call? 的可能重复项
-
这个问题出现得太频繁了,无论如何请看:How to return the response from an AJAX call?