From c2bb74ac0096a03438d7eb4ab79ee4b5d5b7ddf0 Mon Sep 17 00:00:00 2001 From: Kyle K Date: Wed, 1 Mar 2017 00:33:22 -0600 Subject: implement and display a list of uploaded files - adds a /api/filenames RESTful API - adds a cute nyancat banner --- static/js/upload.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'static/js/upload.js') diff --git a/static/js/upload.js b/static/js/upload.js index a8a0e5a..da60c13 100644 --- a/static/js/upload.js +++ b/static/js/upload.js @@ -49,4 +49,19 @@ $(function () { function status(message) { $('#status').text(message); } -}); \ No newline at end of file + + function uploadedFilenameList() { + var xhr = new XMLHttpRequest(); + xhr.open('get', '/api/filenames', true); + xhr.onload = function () { + var fnames = JSON.parse(xhr.response); + fnames.forEach(function (element) { + $("#filenames").append("" + element + ""); + }); + } + xhr.send(); + } + uploadedFilenameList(); +}); + + -- cgit v1.2.3