I've successfully developed and deployed my own webservice using WCF C#. Now, I'm looking to utilize JavaScript to call this service, retrieve data from it, and display it on a chart.
Below is the code snippet that I placed within a custom HTML macro in confluence:
<script>
function fetchWebServiceData()
{
var request = $.ajax({
url: "http://mydomain:port/MyService.svc/testRest",
data: "m=aa",
processData: true,
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
console.log(response);
},
error: function (e) {
console.log('error ' + e.status + ' ' + e.responseText);
}
});
}
var result = fetchWebServiceData();
console.log(result);
</script>
Upon inspecting the developer console in Google Chrome (F12), I encountered the following error:
Mixed Content: The page at '' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ''. This request has been blocked; the content must be served over HTTPS.
I have already added the service URL to the whitelist. If I enable SSL on my domain, would this resolve the issue? Are there alternative solutions?
The end goal is to dynamically populate tables and charts with external data. To achieve this, I began by creating a service that returns JSON data. Once this initial step is successful, I can use the retrieved data to populate a HighCharts component, for instance.