Basic user authentication works on Android, does not on iOS.

Basic user authentication works on Android, does not on iOS.

I'm building an app that gets data from a server using basic user authentication. This works fine on Android, but on iOS nothing happens. In safari it also works fine.

This is the code I'm using:


$.ajax({
url: main_url+'api-cache/'+slug+'.json?r='+random_number(),
dataType: 'json',
headers: {
'Authorization': "Basic " + btoa(localStorage.getItem('email') + ":" + localStorage.getItem('password'))
}
})
.done(function(result) {


main_url is a link to an https website.

I have als tried username and passwork like the jQuery documentation says and also beforesend, nothing seems to work. Without the authentication it works fine by the way. Also the result seems to be ".done" because no error is fired in ".fail".

Help? Oh and btw, I'm using Phonegap Build.