Jquery ajax requests works fine in IE but it gives a below error in chrome
XHR failed loading: OPTIONS http://someurl/
send @ jquery.min.js:2
ajax @ jquery.min.js:2
(anonymous) @ index.html:6
event after adding below parameters header
$.ajax({
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa("user" + ":" + "passoword"));
},
url: 'url',
type: 'get',
contentType:'text/html',
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'OPTIONS, HEAD, GET, POST, PUT, DELETE'
},
success: function( data, textStatus, jQxhr ){
alert(data);
$('#idc').html( data );
},
error: function( xhr, textStatus, errorThrown ){
alert(errorThrown+xhr.status+textStatus);
}
});
Application uses basic authentication and it works fine in ie but in chrome it is not picking the credentials and redirecting to other url where credentials needs to be entered. I gone through all the urls in stackoverflow but nothing worked