diff options
author | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-03-10 21:01:45 +0100 |
---|---|---|
committer | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-03-10 21:01:45 +0100 |
commit | cb57ec90fc3ae16d956b7921287b89876cf6c127 (patch) | |
tree | 20f58ff4f157e3aa06337c4044853ad826ba0321 | |
parent | 1.0.12.28-beta: now auto update != all db clear (diff) | |
download | beziapp-cb57ec90fc3ae16d956b7921287b89876cf6c127.tar beziapp-cb57ec90fc3ae16d956b7921287b89876cf6c127.tar.gz beziapp-cb57ec90fc3ae16d956b7921287b89876cf6c127.tar.bz2 beziapp-cb57ec90fc3ae16d956b7921287b89876cf6c127.tar.lz beziapp-cb57ec90fc3ae16d956b7921287b89876cf6c127.tar.xz beziapp-cb57ec90fc3ae16d956b7921287b89876cf6c127.tar.zst beziapp-cb57ec90fc3ae16d956b7921287b89876cf6c127.zip |
-rw-r--r-- | js/gsec.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/gsec.js b/js/gsec.js new file mode 100644 index 0000000..ecc156b --- /dev/null +++ b/js/gsec.js @@ -0,0 +1,40 @@ +// tab = 2 || any spaces; use tabs +const GSE_URL = "https://zgimsis.gimb.tk/gse/" +class gsec { + constructor(gseuser = null, gsepass = null) { + this.gseuser = gseuser; + this.gsepass = gsepass; + } + postback(theUrl, params, formId = null) { + return Promise( (resolve, reject) => { + $.ajax({ + crossDomain: true, + url: theUrl, + cache: false, + type: "GET", + dataType: "html", + success: (getData) => { + var parsed = document.createElement("html"); + parsed.innerHTML = getData; + if(formId == null) { + var form = parsed.getElementsByTagName("form")[0]; + } else { + var form = parsed.getElementById(formId); + } + var otherParams = $(form).serializeArray(); + var action = form.getAttribute("action"); // absolute url + $.ajax({ + crossDomain: true, + url: action, + cache: false, + type: "POST", + dataType: "text", + success: (postData) { + resolve(postData); + } + }); + } + }); + } + } +} |