</div>
</div>
<div class="grid--cell mb0 mt4">
<a href="/questions/20035101/why-doesn-t-postman-get-a-no-access-control-allow-origin-header-is-present-on" dir="ltr">Why doesn’t Postman get a “No 'Access-Control-Allow-Origin' header is present on the requested resource” error when my JavaScript code does?</a>
<span class="question-originals-answer-count">
(8 answers)
</span>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2015-09-11 20:12:32Z" class="relativetime">4 years ago</span>.</div>
</div>
</aside>
All, I have the following ajax request that works fine in IE (I know right??) but when I try to use the same code in Chrome I get the following error:
XMLHttpRequest cannot load http://ahmwpsds01:1234/NASAService/GetNASAUser.asmx/GetUserByName. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://ahmwpsds01' is therefore not allowed access. The response had HTTP status code 500.
Ajax Request
function getNASAProfile(user) {
var dfd = new $.Deferred(function () {
$.support.cors = true;
$.ajax({
type: "POST",
url: "http://ahmwpsds01:1234/NASAService/GetNASAUser.asmx/GetUserByName",
data: "{userName: '" + UserProfile.Name + "'}",
dataType: "json",
contentType: "application/json; charset=utf-8",
accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
})
.done(function (data) {
//alert('Call Succeeded');
dfd.resolve(data.d);
})
.fail(function (jqXHR, textStatus, errorThrown) {
alert('Call Failed
' + jqXHR.statusText + "
" + errorThrown + "
" + textStatus);
});
});
return dfd.promise();
}
Any thoughts?
</div>