データを取得するためにクロスドメイン ajax リクエストを作成しています。REST サービスにはBasic authentication
( で設定IIS
) があります。
$.ajax({
type: "GET",
xhrFields: {
withCredentials: true
},
dataType: "jsonp",
contentType: "application/javascript",
data: myData,
async: false,
crossDomain: true,
url: "http://xx.xx.xx.xx/MyService/MyService.svc/GetData",
success: function (jsonData) {
console.log(jsonData);
},
error: function (request, textStatus, errorThrown) {
console.log(request.responseText);
console.log(textStatus);
console.log(errorThrown);
}
});
このリクエストを行うと、資格情報を入力するように求められます。応答を得るには、資格情報を手動で入力する必要があります。これらの認証情報をリクエスト自体で送信できますか?