//Use jQuery's beforeSend callback to add an HTTP header with //the authentication information: beforeSend: function (xhr) { xhr.setRequestHeader ("Authorization", "Basic " + btoa(username + ":" + password)); },