-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
83 lines (69 loc) · 2.34 KB
/
index.html
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html>
<head>
<title>YUAG Collection Search</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>YUAG Collection Search</h1>
<form method="get" action="/search">
<label>Label: </label>
<input type="text" id="l" autoFocus>
<br>
<label>Classification: </label>
<input type="text" id="c" autoFocus>
<br>
<label>Agent: </label>
<input type="text" id="a" autoFocus>
<br>
<label>Department: </label>
<input type="text" id="d" autoFocus>
<br>
<strong>{{error_msg}}</strong>
</form>
<br>
<br>
<p id="resultsParagraph"></p>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js">
</script>
<script>
'use strict';
function handleResponse(response)
{
$('#resultsParagraph').html(response);
}
let request = null;
function getResults()
{
let label = $('#l').val();
let classifier = $('#c').val();
let agent = $('#a').val();
let department = $('#d').val();
label = encodeURIComponent(label);
classifier = encodeURIComponent(classifier);
agent = encodeURIComponent(agent);
department = encodeURIComponent(department);
let url = '/search?l=' + label + '&' + 'c=' + classifier + '&' + 'a=' + agent + '&' + 'd=' + department;
if (request != null)
request.abort();
request = $.ajax(
{
type: 'GET',
url: url,
success: handleResponse
}
);
}
function setup()
{
$('#l').on('input', getResults);
$('#c').on('input', getResults);
$('#a').on('input', getResults);
$('#d').on('input', getResults);
$('#l').val();
}
$('document').ready(setup);
</script>
</body>
</html>