Currently I have a variable called "data" that I assign static JSON data, then push the values to arrays using three variables named rev_date, rev_area & rev_cases, using the following Javascript code;
data = [{
"date": "2020-10-17",
"areaName": "Devon",
"newCasesByPublishDate": "108"
}, {
"date": "2020-10-16",
"areaName": "Devon",
"newCasesByPublishDate": "76"
}];
let rev_date = [];
let rev_area = [];
let rev_cases = [];
data.map((item) => {
rev_date.push(item.date);
rev_area.push(item.areaName);
rev_cases.push(item.newCasesByPublishDate);
});
My question is, there is an api that returns the same data in JSON format, using the following URL - https://api.coronavirus.data.gov.uk/v1/data?filters=areaType=utla;areaName=devon&structure={"date":"date","areaName":"areaName","newCasesByPublishDate":"newCasesByPublishDate"}
Is there an easy way using ajax or something else to replace my static "data" variable holding the JSON data, to pull the data dynamically from the URL above?