diff options
author | Ian C <ianc@noddybox.co.uk> | 2018-06-25 21:02:25 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2018-06-25 21:02:25 +0000 |
commit | 52d3b59d43d1c4894a38d47b9606c0f1cff95156 (patch) | |
tree | 55e923759a23288b4bda2c5f24541659c48c0508 /www/scripts | |
parent | 22e2906e30fde29271b1a0f1db08023551b9d8ec (diff) |
Added group parameter to PHP pages and started on Load functionality.
Diffstat (limited to 'www/scripts')
-rw-r--r-- | www/scripts/main.js | 38 |
1 files changed, 38 insertions, 0 deletions
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 |