summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-05 16:33:59 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-05 16:33:59 +0200
commitd75351b30c38dc22e0071e18dc68be551eb628a7 (patch)
tree42cf1576b093977f8c0a95cdd49931ec0ad7a8ae /public
parent3198689286984a47d0250712d9928c7a9ff2f7b9 (diff)
Use POST requests to modify data
Diffstat (limited to 'public')
-rw-r--r--public/static/js/travelynx-actions.js26
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);
+ });
+ });
+});