API, CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

bertscjn1
Community Explorer

Hello, all

Ok, I am completely stumped. I have spent hours watching videos, following tutorials, tinkering with both my IIS server, the webconfig file on the IIS server, and my code itself. I have just been spinning my wheels so I come begging for help!

I made a webapp using HTML and Javascript making API calls via AJAX. Below is my Javascript code. What am I missing? Any help is greatly appreciated. 

      	var API_Key = "MyAPIKEY";
      	function courseSearchID(){
      		var CourseID = document.getElementById("courseName").value;
      		console.log("Course Id:" + CourseID);

	var available = {
            "url": "https://[myDomain]/api/v1/courses/sis_course_id:" + CourseID +"?access_token="+API_Key,
	    "default":{
            "dataType": "jsonp",
	    "type": "GET",
	    "contentType": "Application/json",
	    "crossDomain": true,
	    "Access-Control-Allow-Origin": "*",
	        }}

	$.ajax(available).done(function (response) {
	    console.log(response);
	    var contentname = response.name;
	    var content = response.workflow_state;
	    $("#available").append("Course Name: ").append(contentname).append("<br>Status: ").append(content);
	        console.log("Course Availability");
})
Labels (4)
Users who also had this question