Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/upcoming/upcoming-www
Browse files Browse the repository at this point in the history
  • Loading branch information
waxpancake committed Jun 4, 2016
2 parents 5e61cde + 4cb940d commit fa7e598
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions public/js/watchlists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$(document).ready(function() {
// HACK: Setting Recommended Status via AJAX Call
$.get('/watchlist/status/' + $('#event_id').val(), function(data) {
if(data) {
$('#watchlist-btn').addClass('watchlist-active');
$('#status').val('remove');
}
});

// Add/Remove from Watchlist
$('#watchlist-btn').click(function(e) {
e.stopPropagation();

var post = {
event_id: $('#event_id').val(),
status: $('#status').val()
};

$.post('/watchlist', post, function(data) {
if($('#status').val() == 'attend') {
$('#watchlist-btn').addClass('watchlist-active');
$('#status').val('remove');
} else {
$('#watchlist-btn').removeClass('watchlist-active');
$('#status').val('attend');
}
});

return false;
});
});

0 comments on commit fa7e598

Please sign in to comment.