aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-11-15 21:39:32 +0100
committerMateja <mail@matejamaric.com>2020-11-15 21:39:32 +0100
commita197dec136feae5cbf770f412cb951a62ed62564 (patch)
treee458009be2632c677a5589700de74f415d08edde /public
parentc7cac63894263ab825dfd02c180d2efe8faf8bdc (diff)
downloadyota-laravel-a197dec136feae5cbf770f412cb951a62ed62564.tar.gz
yota-laravel-a197dec136feae5cbf770f412cb951a62ed62564.zip
AJAX select special callsign from activities finished.
Diffstat (limited to 'public')
-rw-r--r--public/js/activities.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/public/js/activities.js b/public/js/activities.js
index f9c19ac..94bee2d 100644
--- a/public/js/activities.js
+++ b/public/js/activities.js
@@ -8,8 +8,31 @@ jQuery('select#call-sign').change(fillTable);
jQuery(document).ready(fillTable);
function fillTable() {
+ tableData = jQuery('table#ajax-table>tbody').first();
+ tableData.html('<tr><td class="font-weight-bold text-center" colspan="6">Loading...</td></tr>');
+
sign = jQuery('select#call-sign').first().val();
+
jQuery.post('/api/activities', {'call-sign': sign}, function (data, status) {
- console.log(data);
+ if (status === 'success') {
+ if (data.data.length > 0) {
+ tableData.empty();
+ for (var i = 0, len = data.data.length; i < len; i++) {
+ tr = '<tr><td>' + data.data[i].operatorCall + '</td>' +
+ '<td>' + data.data[i].fromTime + '</td>' +
+ '<td>' + data.data[i].toTime + '</td>' +
+ '<td>' + data.data[i].specialCall + '</td>' +
+ '<td>' + data.data[i].frequencies + '</td>' +
+ '<td>' + data.data[i].qso + '</td></tr>';
+ tableData.append(tr);
+ }
+ }
+ else {
+ tableData.html('<tr><td class="font-weight-bold text-center" colspan="6">No data...</td></tr>');
+ }
+ }
+ else {
+ tableData.html('<tr><td class="font-weight-bold text-center" colspan="6">Error!</td></tr>');
+ }
});
}