forked from Ticklers/Battle-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.html
44 lines (44 loc) · 1.14 KB
/
header.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
<!DOCTYPE html>
<html>
<head>
<title>My Search page</title>
<script type="text/javascript">
var showResults = debounce(function (arg) {
var value = arg.trim();
if (value == "" || value.length <= 0) {
$("#search-results").fadeOut();
return;
} else {
$("#search-results").fadeIn();
}
var vquery = $.get(
"localhost:5000/api/feed/search?q=" + value,
function (data) {
$("#search-results").html("");
}
)
.done(function (data) {
if (data.length === 0) {
$("#search-results").append(
'<p class="lead-text-center mt-2">No results</p>'
);
} else {
data.forEach((x) => {
$("#search-results").append('<a href = "#"><p></p></a>');
});
}
})
.fail(function (err) {
console.log(err);
});
}, 200);
</script>
</head>
<body>
<input
aria-label="Search"
class="form control"
onkeyup="showResults(this.value)"
/>
</body>
</html>