Dies ist eine Frage, basierend auf: Trying to get tag-it to work with an AJAX calljQuery TagIt (Autocomplete) Fetching JSON Liste über AJAX
jedoch die oben schafft nur eine Fehlermeldung von ‚this.source ist keine Funktion‘ für mich.
Ich versuche, diese Json-Liste als Tag-Quelle für Tagit über Ajax angezeigt werden. Code unten:
// Tagit
$("#tags").tagit({
tagSource: function() {
$.ajax({
url: "/admin/ajax.php?q=fetch_all_tags",
dataType: "json",
success: function(data) {
console.log(data);
return data;
}
});
}
});
Die Ajax-Aufruf zurückkehrt:
{"4":"php","2":"html","3":"css"}
Vielen Dank, @rjdmello Ihr Code-Snippet funktioniert perfekt und es ist die beste Antwort hier. – DccBr
melhor resposta. – cura