-
Notifications
You must be signed in to change notification settings - Fork 9
/
search.php
35 lines (27 loc) · 828 Bytes
/
search.php
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
<?php
include_once("includes/header.php");
?>
<div class="textboxContainer">
<input type="text" class="searchInput" placeholder="Search for something">
</div>
<div class="results">
</div>
<script>
$(function () {
var username = '<?php echo $userLoggedIn; ?>';
var timer;
$(".searchInput").keyup(function() {
clearTimeout(timer);
timer = setTimeout(function() {
var val = $(".searchInput").val();
if(val != "") {
$.post("ajax/getSearchResults.php", { term: val, username: username }, function(data) {
$(".results").html(data);
})
} else {
$(".results").html("");
}
}, 500);
})
})
</script>