0

Could anyone please tell me what I am doing wrong:

I'm using the following code and getting a Cross Origin Domain Blocking error. And no I don't have the ability to enable CORS on the Server Im getting data from. But when I use the URL by itself, I get the data I am after, it's just not working with AJAX, Im trying to use JSONP to get around the issue:

        $(document).ready(function () {
            $.ajax({
                      url: "https://serveraddress/remote-json.cfm?do=gettimetable",
                      dataType: "jsonp",
                      jsonpCallback: "logResults"
            });
        });

kind regards, Brad

Brad Nielsen
  • 179
  • 1
  • 1
  • 4
  • See the *How to use a CORS proxy to get around “No Access-Control-Allow-Origin header” problems* section of the answer at https://stackoverflow.com/questions/43871637/no-access-control-allow-origin-header-is-present-on-the-requested-resource-whe/43881141#43881141 – sideshowbarker Nov 12 '18 at 02:59

1 Answers1

0

You can use back-end to solve this problem. This back-end(php, java, nodejs, curl...) implement a httpclient to getting data from any server.

I try to set "useDefaultXhrHeader: false", it is the configuration ajax.

VuNT
  • 21
  • 3