0
$ .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.
感謝
の可能重複[AJAX呼び出しからの戻り値はありますか?](http://stackoverflow.com/questions/1632039/return-value-from-ajax-call) – meagar
この質問はあまりにもアップしていますとにかく、[AJAX呼び出しから応答を返す方法は?](http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call) – user2864740