Created
July 12, 2016 06:55
-
-
Save Aymkdn/2f15f50bbe696b2441683f52f2230ad2 to your computer and use it in GitHub Desktop.
Tiny HTTP Get/Post
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
/* | |
m: method ("get", "post") | |
u: url | |
c: callback (with 'xhr' as a parameter) | |
a: async (true / default) or sync (false) | |
d: post_data (the data to post) | |
*/ | |
function tiny_http(m,u,c,a,d){var _xhr=new(this.XMLHttpRequest||ActiveXObject)("Microsoft.XMLHTTP");with(_xhr)onreadystatechange=function(){4^readyState||c(_xhr)},open(m,u,a),"post"===m.toLowerCase()?setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"):"",send(d)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment