AnsweredAssumed Answered

CORS missing

Question asked by barand on Oct 29, 2018
Latest reply on Oct 29, 2018 by wimdecorte

Hello,

 

I am trying to append to an unsorted list <ul> in html with the FM Data API. The JS libraries that I am using are jquery and ajax.

 

But I get an error saying: Reason: CORS header ‘Access-Control-Allow-Origin’ missing

 

 

$(function(){

    var $tableLine = $('#tableLine');

   

    $.ajax({

        async: true,

        crossDomain: true,

        xhrFields: {

        withCredentials: true

        },

        type: 'GET',

        url: 'https://myserver.com/fmi/data/v1/databases/WSM%20testbestand/layouts/MOCK_DATA/records?_offset=1&_limit=10',

        dataType: 'json',

        contentType: 'application/json',

        headers: {

                    'Authorization': 'Bearer <<token>>'},

        succes: function(lines){

        $.each(lines, function(i , line){

        $tableLine.append('<li>' + line.first_name + '</li>')

    });

    }

 

How do I add the CORS? I thought that I had added it correctly but that apparently isn't the case.

 

Kind regards,

 

Baran

Outcomes