-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cookbooks, Food & Wine.php
129 lines (116 loc) · 3 KB
/
Cookbooks, Food & Wine.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://fonts.googleapis.com/css?family=Poppins&display=swap" rel="stylesheet">
<link rel="stylesheet" href="navbar.css">
<link rel="stylesheet" href="Logo.css">
<script src="jquery.js"></script>
<script src="bootstrap.js"></script>
<title>booklist</title>
</head>
<body>
<nav>
<div class="logo">
<h4>BOOKSFORME</h4>
</div>
<ul class="nav">
<li>
<a href="home.html">HOME</a>
</li>
<li>
<a href="booklist.php">BOOKLIST</a>
</li>
<li>
<a href="logout.php">LOG OUT</a>
</li>
<li>
<div class="search-container">
<form action="searching.php" method="POST">
<input type="text" name="query"/>
<button><input type="submit" name="searchbutton" value="Search" /></button>
</form>
</div>
</li>
</ul>
<div class="burger">
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
</div>
</nav>
<div class="containering" style="width:800px;">
<br />
<span id="business_list"></span>
<br />
<br />
</div>
</body>
<script src="app.js"></script>
</html>
<script>
$(document).ready(function(){
load_business_data();
function load_business_data()
{
$.ajax({
url:"cookbooksfetch.php",
method:"POST",
success:function(data)
{
$('#business_list').html(data);
}
});
}
$(document).on('mouseenter', '.rating', function(){
var index = $(this).data("index");
var business_id = $(this).data('business_id');
remove_background(business_id);
for(var count = 1; count<=index; count++)
{
$('#'+business_id+'-'+count).css('color', '#ffcc00');
}
});
function remove_background(business_id)
{
for(var count = 1; count <= 5; count++)
{
$('#'+business_id+'-'+count).css('color', '#ccc');
}
}
$(document).on('mouseleave', '.rating', function(){
var index = $(this).data("index");
var business_id = $(this).data('business_id');
var rating = $(this).data("rating");
remove_background(business_id);
//alert(rating);
for(var count = 1; count<=rating; count++)
{
$('#'+business_id+'-'+count).css('color', '#ffcc00');
}
});
$(document).on('click', '.rating', function(){
var index = $(this).data("index");
var business_id = $(this).data('business_id');
$.ajax({
url:"insert_rating.php",
method:"POST",
data:{index:index, business_id:business_id},
success:function(data)
{
if(data == 'done')
{
load_business_data();
alert("You have rate "+index +" out of 5");
}
else
{
alert("There is some problem in System");
}
}
});
});
});
</script>