Hello,
I can’t get a connection to the Pimatic API because CORS is not enabled on the page.
I’ve looked through the forum but I could not find anything about this.
I’m using a jQuery AJAX call to retrieve the device information:
$.ajax(
{
type: "GET",
url: this.settings.url,
dataType: "json",
success: function(data)
{
resolve(data);
},
error: function()
{
reject(new Error("An error occurred while processing the data"));
},
beforeSend: function(req)
{
req.setRequestHeader("Authorization", "Basic " + btoa(this.settings.username + ":" + this.settings.password));
}.bind(this)
});
If I change this to JSONP it does load the correct data, but Pimatic does not support this feature so it returns a parsing error.
Enabling CORS would be the best solution in my opinion
Do you guys have any experience with this?