If you want to make a simple API call, follow these steps:
$.getJSON('**WEB_URL_API_ENDPOINT**', function(data){
console.log(data);
});
Take a look at the console to observe how the data is being returned (single, list, etc..)
Based on how the data is returned (single, list, etc..), you can use different approaches.
A basic loop to add elements to a list:
$.getJSON('**WEB_URL_API_ENDPOINT**', function(data){
var dataList = []
for (var i=0; i<data.length; i++) {
dataList.push([data[i].city, data[i].state, data[i].address,
data[i].zipcode]);
}
});
If the data is not returned as a list, you can directly access the elements by their names.
$.getJSON('**WEB_URL_API_ENDPOINT**', function(data){
var city = data.city;
var state = data.state;
var address = data.address;
var zipcode = data.zipcode;
});