-
Notifications
You must be signed in to change notification settings - Fork 0
/
comicsbook.php
87 lines (77 loc) · 1.94 KB
/
comicsbook.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>
<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>
</head>
</html>
<script>
$(document).ready(function(){
load_business_data();
function load_business_data()
{
$.ajax({
url:"comicsbookfetch.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>