I am trying to create a basic authentication through the browser, but I can\'t really get there.
If this script won\'t be here the browser authentication will take o
The examples above are a bit confusing, and this is probably the best way:
$.ajaxSetup({ headers: { 'Authorization': "Basic " + btoa(USERNAME + ":" + PASSWORD) } });
I took the above from a combination of Rico and Yossi's answer.
The btoa function Base64 encodes a string.