I have a local web service that is: http://localhost:8088/api/DuplicateCleaner/table
The service works fine when called from a browser, the returned value is a string for example: table
I am coding a simple HTML page to call it, my first attempt was using jQuery $.getJSON, which failed with this error: Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
When I researched this error, I came across a solution by using jsonp which unfortunately returns the error things?callback=jQuery1102036_1475067308508&things=table&_=1475067308509:1 Uncaught ReferenceError: things is not defined
As you see in my code, things is the parameter which will be holding the data passed to the service.
<html>
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<script type="text/javascript">
function jsonCallback(_json){
console.log(_json);
}
$.ajax({
url: "http://localhost:8088/api/DuplicateCleaner/things",
data: {
'things': "table"
},
dataType: "jsonp"
});
</script>
</body>
</html>
I am just looking to use the service from a simple HTML page!