Skip to content

Instantly share code, notes, and snippets.

@DenesKellner
Last active September 21, 2020 11:53
Show Gist options
  • Save DenesKellner/6d754c82468540602760f144ed1e6e82 to your computer and use it in GitHub Desktop.
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.
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