travelynx/public/static/js/travelynx-actions.js

27 lines
723 B
JavaScript
Raw Normal View History

2018-10-05 14:33:59 +00:00
$(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);
});
});
});