Chrome阻止了ajax请求[重复]

This question already has answers here:
                </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>

EDIT: Didn't notice that you want to make a POST request. You should consider using a backend method for your case

You are trying to access a resource that is on a different server. For security reasons, you are not allowed to do that with a simple AJAX call.

To work out the problem, you can use JSONP. The simple way to do it is to add ?callback=? to the URL. Plus, the server response must be wrapped in a function definition. You might want to use a proxy like YQL to convert the response to JSONP.

More information on this link : http://json-jsonp-tutorial.craic.com/index.html