Skip to content

Instantly share code, notes, and snippets.

@ryanrolds
Created October 26, 2012 18:24
Show Gist options
  • Save ryanrolds/3960511 to your computer and use it in GitHub Desktop.
Save ryanrolds/3960511 to your computer and use it in GitHub Desktop.
var url = [
'https://moonshadow.loggly.com/api/search',
'?q=json.message:"queryserver load" json.fqdn:rsquery1'
].join('');
$.ajax({
'url': url,
'beforeSend': function(xhr) {
var token = ['username', 'password'].join(':');
var hash = btoa(token);
xhr.setRequestHeader('Authorization', 'Basic ' + hash);
},
'success': function(data) {
console.log(data);
},
'error': function(XMLHttpRequest, textStatus, errorThrown) {
console.log(textStatus+" - "+errorThrown);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment