problems authenticating an ajax request
Hello all,
I'm trying to send an ajax request which should authenticate via basic http authentication.
In the jQuery.ajax() documentation page (http://api.jquery.com/jQuery.ajax/) it states that there are two options, "username" and "password" that can be specified, and that they are going "to be used in response to an HTTP access authentication request."
I set those two options in my request, but I cannot see any "Authorization: Basic xxx" header being send by jquery.
this is my code:
$.ajax( {
cache: false,
url: 'http://...',
type: 'GET',
dataType: 'xml',
username: 'username',
password: 'password',
success: function(xml) {
// ...
}
});
I have see that a lot of people suggest to use the beforeSend hook and set the Authorization header manually (using setRequestHeader()) but I really want to avoid this.