0
J'ai un problème avec la méthode utilisant $ .getJSON. Il est très simple et ça ressemble à ça:
function lastID(query) {
$.getJSON(url+query ,function(json){
var type_id = json.data;
});
return type_id // doesn't work
}
Pourriez-vous s'il vous plaît me dire comment revenir type_id à une autre valeur, par exemple, comme ceci:
var returnedID = lastID(query); // this schould me equal to returned type_id from lastID method.
Un grand merci pour votre réponse
double possible de [valeur de retour de l'appel ajax?] (Http://stackoverflow.com/questions/1632039/return-value-from-ajax-call) – meagar
Cette question revient beaucoup trop souvent, de toute façon voir: [Comment retourner la réponse d'un appel AJAX?] (http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call) – user2864740