This question is locked. New answers and comments are not allowed.
I have ajax code in my script. Problem is when request start, after beforeSend part ajax code ends (out of the ajax scope). It is not going into error or success part on Ios. But on android it is working properly. Do you have any idea why? I suspect setRequestHeader or btoa methods
$.ajax({
url: connectionString ,
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "json",
beforeSend: function (xhr) {
alert("before send");
xhr.setRequestHeader('Authorization',
"Basic " + btoa(username+ ":" + password));
},
error: function (xhr, ajaxOptions, thrownError) {
alert("error");
...
},
success: function (a) {
alert("success");
...
}
});
$.ajax({
url: connectionString ,
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "json",
beforeSend: function (xhr) {
alert("before send");
xhr.setRequestHeader('Authorization',
"Basic " + btoa(username+ ":" + password));
},
error: function (xhr, ajaxOptions, thrownError) {
alert("error");
...
},
success: function (a) {
alert("success");
...
}
});