diff --git a/velconnect/static/js/util.js b/velconnect/static/js/util.js index b4877ff..3d94740 100644 --- a/velconnect/static/js/util.js +++ b/velconnect/static/js/util.js @@ -14,6 +14,23 @@ function httpGetAsync(theUrl, callback, failCallback) { xmlHttp.send(null); } + +function httpPostAsync(theUrl, data, callback, failCallback) { + var xmlHttp = new XMLHttpRequest(); + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4) { + if (xmlHttp.status == 200) { + callback(xmlHttp.responseText); + } else { + failCallback(xmlHttp.status); + } + } + } + xmlHttp.open("POST", theUrl, true); // true for asynchronous + http.setRequestHeader('Content-type', 'application/json'); + xmlHttp.send(data); +} + function getCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); diff --git a/velconnect/templates/index.jinja b/velconnect/templates/index.jinja index fcab8cf..ae0e46b 100644 --- a/velconnect/templates/index.jinja +++ b/velconnect/templates/index.jinja @@ -38,9 +38,10 @@
+