var auth = btoa('username:password'); $.ajax({ type: 'GET', url: 'http://example.com', headers: { "Authorization": "Basic " + auth }, success : function(data) { }, });