import 'babel-polyfill'; import * as search from './lib/search'; import * as dom from './lib/dom'; import * as ajax from './lib/ajax'; async function resultClicked(grilId) { let response = null; try { response = await ajax.post( window.location, 'id=' + grilId, { headers: { 'Content-type': 'application/x-www-form-urlencoded' } }); } catch (e) { alert(e.message); return; } document.getElementById('gril-list').innerHTML += response; } function main() { let is = new search.InstantSearch( document.getElementById('gril-add-search'), document.getElementById('search-results')); is.resultClicked = resultClicked; } dom.ready(main);