What is the easiest way to pass along BASIC authentication credentials that are currently stored by the browser in the session cookie when making the .autocomplete call? I know that I can use the ajax method with username and password, but I do not know how to retrieve said information from the browser.
Essentially, the user logs in using the htpswd/htaccess functionality of apache, and I know that thr browser must be storing the information in a cookie. My question is how do I retrieve said information to be used in the AJAX call, so that it does not return a 410 response?
My current code:
$( ".item" ).autocomplete({
source: function(request, response){$.get("https://www.mydomain.com/blah/bling/blat/",
function(data){response(JSON.parse(data));});},
minLength: 2
});
Authentication credentials are not stored in a cookie. I don’t think JavaScript can access it directly. But I don’t think it needs to. If the credentials are needed, the browser will send them automatically, and prompt the user if necessary. See here for some more details.