0

Here is my ajax call:

jQuery.ajax({
    type: 'GET',
    dataType: 'xml',
    url: 'http://XYZ/AAA/BBB.asmx?op=QQQ',
    data: user_id,
    contentType: 'application/xml; charset=utf-8',
    headers: {
        'Access-Control-Allow-Origin': '*'
    },
    success: function (data) {
        alert(data);
    },
    error: function (data) {
        alert(data);
    }
});

I'm getting the following errors:

  1. 403 forbidden error.
  2. XmlHttpRequest cannot be loaded.
  3. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:55777' is therefore not allowed access.
  • There is already an answer here https://stackoverflow.com/questions/35304817/basic-ajax-request-gets-no-access-control-allow-origin-header-is-present-on-t – Nabil Ali Aug 23 '17 at 10:34
  • Access-Control-Allow-Origin should be set on the server response, not the client request. If the response does not have those headers, and you do not control the server to be able to add them, then you will not be able to make a request to that domain due to the Same Origin Policy – Rory McCrossan Aug 23 '17 at 10:47

0 Answers0