aboutsummaryrefslogtreecommitdiff
path: root/assets_src/js/list.js
blob: 413f517fcc8f60c02e58cfdec98beadf872176df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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);