diff options
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 |