I am a newbie to Jquery. I am trying to send a request with basic authentication using jquery. This is what i do.
$.ajax({
type: "GET",
url: domain,
dataType: 'json',
success: function(){
alert('Thanks for your comment!');
},
error:function(){
alert('here');
},
beforeSend: function(xhr){
xhr.setRequestHeader('Authorization', 'Basic ' + encodeBase64(username + ":" + password));
}
});
But my problem is I dont get any feedack. Looks like both the success or the error method is called.
On further debugging i get
Uncaught ReferenceError: encodeBase64 is not defined
What am i missing? Help would be appreciated.