diff options
Diffstat (limited to 'public/static/js')
-rw-r--r-- | public/static/js/travelynx-actions.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js new file mode 100644 index 0000000..3fbbdea --- /dev/null +++ b/public/static/js/travelynx-actions.js @@ -0,0 +1,26 @@ +$(document).ready(function() { + $('.action-checkin').click(function() { + var link = $(this); + req = { + action: 'checkin', + station: link.data('station'), + train: link.data('train'), + }; + link.replaceWith('<div class="progress"><div class="indeterminate"></div></div>'); + $.post('/action', req, function(data) { + $(location).attr('href', '/'); + }); + }); + $('.action-checkout').click(function() { + var link = $(this); + req = { + action: 'checkout', + station: link.data('station'), + force: link.data('force'), + }; + link.replaceWith('<div class="progress"><div class="indeterminate"></div></div>'); + $.post('/action', req, function(data) { + $(location).attr('href', '/' + req.station); + }); + }); +}); |