From 9a25f5f94900b0474b6c5f2fff254a3418ca7f38 Mon Sep 17 00:00:00 2001 From: Humberto Alfonso Díaz Date: Thu, 5 Dec 2019 12:42:48 +0100 Subject: FUNCT Add bootstrap support --- src/js/templates.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/js/templates.js (limited to 'src/js/templates.js') diff --git a/src/js/templates.js b/src/js/templates.js new file mode 100644 index 0000000..2513722 --- /dev/null +++ b/src/js/templates.js @@ -0,0 +1,19 @@ +export function load(template) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', '/templates/'+template); + + xhr.send(); + + xhr.onload = function() { + if (xhr.status != 200) { + console.error('Error loading template', xhr.status, xhr.statusText); + reject(xhr.status); + } else { + console.log(xhr.responseType); + resolve(xhr.responseText); + } + }; + }); +} \ No newline at end of file -- cgit 1.2.3-korg