var suggestView = new ymaps.SuggestView('txtPlaces', { provider: { suggest:(function(request){ var resultArray = []; var resplaces = []; $('ymaps').show(); let suggest = new ymaps.suggest(", " + request); var result = suggest.then(items => { let lengt = items.length; if(lengt == 0){ jQuery.getJSON('https://search-maps.yandex.ru/v1/?text=, '+request+'&lang=ru_RU&apikey=7317da38-8902-49f2-a0c7-86a26cc2c60f', function (json) { resplaces = json.features; for (const i of resplaces) { resultArray.push({ value: i.properties.description, displayName: i.properties.description+' - '+i.properties.name }); } }); } else { for (const i of items) { resultArray.push({ value: i.value, displayName: i.displayName }); } } return ymaps.vow.resolve(resultArray); }); console.log(resultArray); console.log(result); return ymaps.vow.resolve(result); })} });