I have request json data from other website, but it meets the problem of access control allow origin in header, I have no idea how to set the access control allow origin in header, I'm put my source code in the iis8 to access the json data from another iis8 api source.
$.ajax({
type: "GET",
url:rootURL,
xhrFields: {
withCredentials: false
},
headers: {
"Access-Control-Allow-Origin: ": "*",
"Access-Control-Allow-Methods: ": "GET",
"Access-Control-Allow-Headers: ": "Authorization",
},
dataType: "json",
success: function(data) {
},
error: function() {
alert("An error occurred while processing JSON file.");
}
});