From 52d3b59d43d1c4894a38d47b9606c0f1cff95156 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 25 Jun 2018 21:02:25 +0000 Subject: Added group parameter to PHP pages and started on Load functionality. --- www/scripts/main.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'www/scripts') diff --git a/www/scripts/main.js b/www/scripts/main.js index e3c1f7b..d8f03ca 100644 --- a/www/scripts/main.js +++ b/www/scripts/main.js @@ -1,4 +1,6 @@ +var globalDb; + function AESEncrypt(source, phrase) { var encryptedAES = CryptoJS.AES.encrypt(source, phrase); @@ -13,4 +15,40 @@ function AESDecrypt(source, phrase) return decryptedBytes.toString(CryptoJS.enc.Latin1); } +function WebRequest(url, func, args) +{ + var f; + + for(f = 0; f < args.length; f += 2) + { + if (f == 0) + { + url += "?"; + } + else + { + url += "#"; + } + + url += args[f] + "="; + url += encodeURIComponent(args[f+1]); + } + + var req = new XMLHttpRequest(); + + req.addEventListener("load", func); + req.open("GET", url); + req.send(); +} + +function DoLoadAsync() +{ + globalDb = JSON.parse(this.responseText); +} + +function DoLoad() +{ + WebRequest("get.php", DoLoadAsync, []); +} + // vim: sw=4 ts=4 -- cgit v1.2.3