Created
September 9, 2016 07:35
-
-
Save andreasvirkus/b298098ed492e08e1e8c505bd5845118 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var ajaxPost; | |
(function() { | |
ajaxPost = function (endPoint, obj, failCallback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', endPoint, true); | |
xhr.onload = function() { | |
if (xhr.status != 200 && xhr.status != 4) { | |
failCallback(); | |
} | |
}; | |
xhr.onerror = function() { | |
failCallback(); | |
}; | |
xhr.send(JSON.stringify(obj)); | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment