CORS Policy

  • 11 November 2018
  • 1 reply

Anyone know how to do an API get request from the iparams page?  I keep getting this error when trying to pull in the groups to a dropdown for mapping between two systems.

Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Yes, i have added this to my headers.  It works from everywhere but the app.


This topic has been closed for comments

1 reply

This the code I am currently using:

dataType: "json",
type: "Get",
beforeSend: function(request) {
request.withCredentials = true;
request.setRequestHeader("Authorization", "Basic " + btoa($("#fs_api_key").val() + ":X"));
request.setRequestHeader("Access-Control-Allow-Origin", "*");
request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
url: "https://" + $("#fs_subdomain").val() + "",
success: function(data) {
results = JSON.stringify(data.ticket_fields);
groups = getProperty(results, "group", "choices");
var select = $(dropdown).empty();
$.each(groups, function(key, value) {
select.append('<option value="'+ value +'">'+ key +'</option>');