Skip to content

Instantly share code, notes, and snippets.

@ikwattro
Created May 13, 2015 19:22
Show Gist options
  • Save ikwattro/505a18e2c218c4f440b1 to your computer and use it in GitHub Desktop.
Save ikwattro/505a18e2c218c4f440b1 to your computer and use it in GitHub Desktop.
Neo4j + jquery
var token = user + ':' +pwd;
var hash = btoa(token);
var authHeader = 'Basic ' + hash;
$.ajax({
url: endpoint,
type: "POST",
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', authHeader);
},
data: data,
async: false,
contentType: "application/json"
})
.done(function(result){
console.log(result);
neoError = result.errors;
})
.fail(function(error){
console.log(error.statusText);
displayError(error.statusText);
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment