Skip to content

Instantly share code, notes, and snippets.

@easrng
Created July 22, 2018 23:20
Show Gist options
  • Save easrng/9936e2fc60a7cca7d8548c978d5935d6 to your computer and use it in GitHub Desktop.
Save easrng/9936e2fc60a7cca7d8548c978d5935d6 to your computer and use it in GitHub Desktop.
(function (){
"use strict";
window.sel=window.sel||{};
/* Start Ajax */
function get(url) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { return this.responseText; } };xhttp.open("GET", url, true);xhttp.send();}function post(url, params) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { return this.responseText; } };xhttp.open("POST", url, true);xhttp.send(params);} window.sel.ajax = {get:get,post:post};
/* End Ajax */
/* Start HTML */
function query(q){return document.querySelector(q);} window.sel.html = {query:query}; window.sel.q = query;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment