Skip to content

Instantly share code, notes, and snippets.

@cedeber
Created March 22, 2016 14:14
Show Gist options
  • Save cedeber/ba48c3897ab44bda7c7c to your computer and use it in GitHub Desktop.
Save cedeber/ba48c3897ab44bda7c7c to your computer and use it in GitHub Desktop.
AJAX requests
var myRequest = new XMLHttpRequest();
myRequest.open("GET", url + ((/\?/).test(url) ? "&" : "?") + (new Date()).getTime());
myRequest.open("POST", "http://www.cedeber.fr/");
myRequest.setRequestHeader("Cache-Control", "no-cache");
myRequest.setRequestHeader("Content-Type", "text/plain");
myRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
myRequest.onload = myOnLoadHandlerFunction;
myRequest.send(data||params);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment