summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/templates/js-pciquery.html
blob: 5d4df867e58d7e5d9294c1766d2123340d05f25a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script>
	document.addEventListener('DOMContentLoaded', function() {
		var missing = {{{missing_ids}}};
		var doQuery = function() {
			if (missing && missing.length > 0) {
				$.ajax({
					url: '?do=statistics', dataType: "json", method: "POST", data: {
						token: TOKEN,
						action: 'json-lookup',
						list: missing.splice(0, 10) // Query 10 at a time max
					}
				}).done(function (data) {
					if (!data)
						return;
					for (var k in data) {
						$('.query-' + k.replace(':', '-')).text(data[k]);
					}
					doQuery();
				});
			}
		}
		doQuery();
	});
</script>