I have created an Edge extension that currently makes an Ajax call to a web API i have also developed in order to request data. Currently after hours of testing, I know the Ajax call works correctly and returns the relevant data.
My issue is the Ajax call will fail when I attempt to call it from my Edge extension. It doesn't provide any reasoning or errors, just simply the error message I added to the Ajax call (error: .... see below). Having tested the exact same extension and Ajax call to my web API in chrome the Ajax call from within the extension works correctly and returns the data from which I can then use.
$(document).ready(function () {
$select = $('#brandDropdownList');
$.ajax({
type: "GET",
url: 'http://localhost:44358/api/brands',
dataType: 'JSON',
success:function(data) {
$select.html('');
$.each(data, function(key, val) {
$select.append('<option id="' + val.brand_id + '">' + val.brand_name + '</option>');
})
},
error: function(){
$select.html('<option id="-2">Please try again...</option>');
}
});
Why is this? I have no errors or issues, it works fine in Chrome, but not in Edge and unfortunately I have to use Edge for the project I am undertaking. The only error I can see in the console in dev tools is that there is a warning for:
"serviceWorker.getRegistrations is rejected due to unsecure context or host restriction in ms-browser-extension"