pawelczak / EasyAutocomplete

JQuery autocomplete plugin
http://easyautocomplete.com
MIT License
729 stars 244 forks source link

Managing CROSS ORIGINS request #442

Open francescorm opened 4 years ago

francescorm commented 4 years ago

Hi there, i'm trying to autocomplete a filed requesting JSON data from another server but browser always blocking for non matching CORS policy. My options var is this: var options = { url: function(phrase) { return "CROSS DOMAIN" + phrase; }, ajaxSettings: { method: "GET", crossDomain: true, preparePostData : function(xhr) { xhr.setRequestHeader('Apikey','APIKEY'); return xhr; }, dataType: "json", data: { dataType: "json", Apikey : "APIKEY",

},
  "Access-Control-Allow-Origin" : "http://api.reflexmania.it",
  "Access-Control-Allow-Headers": "x-requested-with, x-requested-by",
   "Access-Control-Allow-Methods": "POST,GET,OPTIONS",
  Apikey : "52bf3c1f206dae8e45bf647cda396172",
  }

}, ...

how can i solve?