I am trying to invoke the SharePoint Rest Api using HTML page. I have included the Access Control Allow Origin to the web.config file. I am getting Readty State 4 and Status Success but still I am getting the below error.
Refused to execute script from 'http://<server>/_api//web/lists?callback=jQuery172045857910416089_1430217181282&_=1430217363882' because its MIME type ('application/atom+xml') is not executable, and strict MIME type checking is enabled.
<script>$(document).ready(function () {
$("#KMPDiscussions").click(function () {
//$.support.cors = true;
$.ajax({
url: "http://<server>/_api//web/lists",
dataType: "jsonp",
type: "GET",
method: "GET",
contentType: "application/javascript",
headers: {
"content-type": "application/json;odata=verbose",
"accept": "application/json;odata=verbose",
},
success: function onSuccess(data) {
alert("Inside Alert");
}
},
error: function onError(data){
alert("Error: " + data);
}
});
});
});
</script>
It always hits the error on callback.
Is there any other way that I can invoke SharePoint Rest Api from a Cross Domain. Please Help.