I have been looking for 5 hours or so but i give up. my ajax get request just does't want to work.
var ApiResponce = $.ajax({
    url: "http://localhost:18428/api/Reservation/" + userid + "?weekNumber=" + weeknr,
    type: 'GET',
    headers: {
        'Authorization': "bearer " + token,  
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Credentials': true,
    },
    dataType: 'json',
    crossDomain: true,
    contentType: "application/json",
    success: function(responce) {
        console.log("success");
        console.log(responce);
    },
    error: function(err) {
      console.log("error");
        console.log(ApiResponce);
    },
});
it connecting to a standard C# mvc api but all that i am getting is this error:
XMLHttpRequest cannot load http://localhost:18428/api/Reservation/1?weekNumber=1. 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' is therefore not allowed access. The response had HTTP status code 405.
 
    