Help using basic auth in jquery for the api?

77 views
Skip to first unread message

Isaac Stanfield

unread,
Sep 11, 2012, 4:52:59 PM9/11/12
to pollevery...@googlegroups.com
I seem to be having trouble getting the basic auth to work in a jquery/json call to the api. I am pretty sure the format is correct and I have included a Base64 encoder script in the header and it is working properly.   Here is what I have -
$.ajax({
'url' : 'http://api.polleverywhere.com/multipl...',
'dataType' : 'json',
'beforeSend': function(xhr) {
xhr.setRequestHeader('Authorization', 'Basic ' + Base64.encode('user:pass'));
},
'success' : function(json) {
alert('workie');
},
'error' : function(xhr,err) {
alert('no workie');
}
});
Reply all
Reply to author
Forward
0 new messages