Commit 66eda255 authored by Renfred Harper's avatar Renfred Harper
Browse files

Isolate update grid function

parent a5eedf3d
...@@ -34,11 +34,8 @@ function construct_grid(filtered_restaurants) { ...@@ -34,11 +34,8 @@ function construct_grid(filtered_restaurants) {
$('#footer').show(); $('#footer').show();
} }
$.ajax({ function update_grid(restaurants) {
url: '/ajax/schedule/', $.each(restaurants, function (idx, restaurant) {
}).done(function (data) {
restaurants = data.data;
$.each(restaurants, function (idx, restaurant) {
var now = new Date(); var now = new Date();
var date = new Date().setHours(0,0,0,0); var date = new Date().setHours(0,0,0,0);
// JavaScript sets 0 to Sunday instead of Monday // JavaScript sets 0 to Sunday instead of Monday
...@@ -103,5 +100,12 @@ $.ajax({ ...@@ -103,5 +100,12 @@ $.ajax({
restaurant.open = false; restaurant.open = false;
}); });
}); });
}
$.ajax({
url: '/ajax/schedule/',
}).done(function (data) {
restaurants = data.data;
update_grid(restaurants);
construct_grid(restaurants); construct_grid(restaurants);
}); });
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment