Question
fetch() in CEP Panel - can't get it to work
Hi All;
Anyone have an idea what the issue is here with a fetch() inside a CEP:
The Fetch() code works fine in a standalone JS, but when part of a CEP, it does not - for me. The code executes all the way to "// Get Here" in the code below. Is Fetch() not an option in CEP or what did I screw up?
"doWorkForComp() "is called from a button event
Thanks so much for any help.
function doWorkForComp(nextLayerToBeProcessed){
var url = 'https://randomuser.me/api/?results=10'; // Get 10 random users
fetchData();
}
function fetchData() {
// Get here
fetch(url)
.then(function(response){
return response.json();})
.then(function(data){
data.results.forEach(function (person) {
alert(person.email);
})
});
}
