-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
124 lines (107 loc) · 3.75 KB
/
index.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mock Restaurant Sorting</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/main_model.css" rel="stylesheet">
<link href="jquery-ui-1.10.4/development-bundle/themes/custom-theme-mini/jquery-ui.css" rel="stylesheet">
<script src="jquery-ui-1.10.4/js/jquery-1.10.2.js"></script>
<script src="jquery-ui-1.10.4/js/jquery-ui-1.10.4.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script>
$(function() {
$("#price").slider({min: 0, max: 10});
$("#steak").slider({min: 0, max: 10});
$("#shakes").slider({min: 0, max: 10});
$("#delivery").slider({min: 0, max: 10});
$("#pizza").slider({min: 0, max: 10});
$("#chicken").slider({min: 0, max: 10});
$("#mexican").slider({min: 0, max: 10});
$("#juice").slider({min: 0, max: 10});
$("#asian").slider({min: 0, max: 10});
$("#evaluate").click(function() {
var price = $("#price").slider("value");
var steak = $("#steak").slider("value");
var shakes = $("#shakes").slider("value");
var delivery = $("#delivery").slider("value");
var pizza = $("#pizza").slider("value");
var chicken = $("#chicken").slider("value");
var mexican = $("#mexican").slider("value");
var juice = $("#juice").slider("value");
var asian = $("#asian").slider("value");
var data_str = "price=" + price + "&steak=" + steak + "&shakes=" + shakes + "&delivery=" + delivery + "&pizza=" + pizza + "&chicken=" + chicken + "&mexican=" + mexican + "&juice=" + juice + "&asian=" + asian;
$.ajax({
type: 'POST',
url: 'get_restaurants.php',
data: data_str,
dataType: 'json',
cache: false,
timeout: 1000,
success: function(data) {
var counter = 0;
var str_response = "";
for(var numeric in data) {
str_response += "<div class=\"restaurant_box\">";
if(counter%4==0) {
str_response += "<div class=\"restaurant_group\">";
}
for(var key in data[numeric]) {
str_response += "<h4>" + key + "</h4>";
for(attr in data[numeric][key]) {
str_response += "<p>" + attr + ": " + data[numeric][key][attr] + "</p>";
}
}
str_response += "</div></div>";
counter++;
}
$("#restaurants_list").html(str_response);
}
});
});
});
</script>
</head>
<body>
<div class="main_container">
<div class="top_header"><h1>Restaurant Listing</h1></div>
<hr />
<form>
<div class="form_input_row">
<label for="price" class="form_left">Price</label><div id="price" class="form_right"></div>
</div>
<div class="form_input_row">
<label for="steak" class="form_left">Steak</label><div id="steak" class="form_right"></div>
</div>
<div class="form_input_row">
<label for="shakes" class="form_left">Shakes</label><div id="shakes" class="form_right"></div>
</div>
<div class="form_input_row">
<label for="delivery" class="form_left">Delivery</label><div id="delivery" class="form_right"></div>
</div>
<div class="form_input_row">
<label for="pizza" class="form_left">Pizza</label><div id="pizza" class="form_right"></div>
</div>
<div class="form_input_row">
<label for="chicken" class="form_left">Chicken</label><div id="chicken" class="form_right"></div>
</div>
<div class="form_input_row">
<label for="mexican" class="form_left">Mexican</label><div id="mexican" class="form_right"></div>
</div>
<div class="form_input_row">
<label for="juice" class="form_left">Juice</label><div id="juice" class="form_right"></div>
</div>
<div class="form_input_row">
<label for="asian" class="form_left">Asian</label><div id="asian" class="form_right"></div>
</div>
</form>
<button class="eval_btn btn btn-lg" id="evaluate">Evaluate</button>
<br />
<br />
<br />
<hr style="border-color: black;" />
<div id="restaurants_list">
</div>
</div>
</body>
</html>