-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
87 lines (81 loc) · 2.11 KB
/
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
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
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="auther" content="Shil Kumar">
<meta http-equiv="X-UA_Compatible" content="IE=etge">
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
<title>--Search--</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<style>
.s{
position: relative;
width: 240px;
height: 30px;
margin-left: -30px;
margin-right: 10px;
z-index: 2;
top: 0;
left: 160px;
}
.s form input[type="text"]{
position: absolute;
top: 0;
left: 0;
width: 190px;
height: 30px;
padding: 10px;
}
.s form input[type="submit"]{
position: absolute;
top: 0;
left: 190px;
width: 60px;
height: 30px;
font-size: 15px;
}
</style>
</head>
<body class="">
<div class="container">
<div class="row">
<div class="s">
<form action="show_search.php" method="post" enctype="multipart/form-data">
<input type="text" name="search" id="search" class="" placeholder="Search by place..." >
<input type="submit" name="submit" value="search" class="" >
</form>
</div>
<div class="">
<div class="list-group" id="show-list" style="margin-top: 35px;margin-left: -90px;z-index: 10;display: inline-flex;">
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#search").keyup(function(){
var searchText = $(this).val();
if(searchText != ''){
$.ajax({
url:'action.php',
method:'post',
data:{query:searchText},
success:function(response){
$("#show-list").html(response);
}
});
}else{
$("#show-list").html('');
}
});
$(document).on('click','a',function(){
$("#search").val($(this).text());
$("#show-list").html('');
});
});
</script>
</body>
</html>