Answer the question
In order to leave comments, you need to log in
How to give information from json by multiple parameters?
You need to filter information from json by 2 levels:
"items":{
"item1":{
"0":{
"type":"рафтинг",
"link":"/raft/",
"name":"Рафтинг",
"id":"145897"
}
},
"item2":{
"3":{
"type":"kids",
"link":"/kids/",
"name":"Для детей",
"id":"145897"
}
}
$.ajax({
url: $('[' + selector + ']').attr(selector),
dataType: 'json',
data: { query: request.term },
success: function(data) {
response($.map(data.items.item, function(item){
return item;
}));
}
});
Answer the question
In order to leave comments, you need to log in
Well, in theory, you need to do .each on items . I won’t tell you the syntax, I did the current with xml .
Take a look at Lodash or Underscore. They have a whole bunch of methods for working with collections, incl. sorting and more.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question