Skip to content Skip to sidebar Skip to footer

How To Use The Data From An Ajax Call

I have the following JQuery AJAX call which successfully returns data from the database - $.ajax({ url : 'get_hashtags.php', type : 'GET', success : function(data){

Solution 1:

extract category data by looping obj and push into an Array and use.

look into code snippe.

var obj = [
  {category: "ht.austria"},
  {category: "ht.landscapes"}
];

var suggestionsArr = [];

obj.forEach(function(item){ 
  suggestionsArr.push(item.category) 
});


console.log('suggestionsArr : ', suggestionsArr);


   /* $('#inputTags').amsifySuggestags({
    suggestions: suggestionsArr,
    classes: ['bg-warning','bg-warning'],
}); */

Post a Comment for "How To Use The Data From An Ajax Call"