Last active
September 21, 2020 11:53
-
-
Save DenesKellner/6d754c82468540602760f144ed1e6e82 to your computer and use it in GitHub Desktop.
Simple AJAX call - thank you w3.js - that has no dependencies so you can live without jQuery and still make calls to the server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ajaxGet(url,cbStateChange,xmlData,method) { | |
var rq; | |
method = method||"GET"; | |
try{ | |
if(window.XMLHttpRequest) | |
{rq = new XMLHttpRequest();} else | |
{rq = new ActiveXObject("Microsoft.XMLHTTP");} | |
;; | |
}catch(e) {return;} | |
if(!rq) return; | |
if(cbStateChange) rq.onreadystatechange = cbStateChange; | |
rq.open(method,url,true); | |
rq.send(xmlData); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment