Skip to content

Instantly share code, notes, and snippets.

@madr madr/hijax.js
Created Jul 25, 2016

Embed
What would you like to do?
var hijax = function (method, uri, callback) {
var client = new XMLHttpRequest();
client.open(method, uri, true);
client.onload = function () {
if (client.status >= 200 && request.status < 400) {
callback(client.responseText);
}
};
client.onerror = function () {
throw client.responseText;
};
client.send();
};
hijax('POST', '/social-auth/facebook', function (r) {
console.log(r);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.