jquery promise play
An anttempt to understand jquery deferred and promise objects
by davehol
HTML
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
JavaScript
//https://stackoverflow.com/questions/4869609/how-can-jquery-deferred-be-used
var cache = {};
function getData() {
// return either the cached value or jqXHR object wrapped Promise
return $.when(
$.ajax({
url: 'https://spreadsheets.google.com/feeds/list/1oxCJb3ilpOSrCcEweXfFWwh36QCFQLHZRkO6y-d_iG0/3/public/values?alt=json-in-script&q=mc201&callback=?',
dataType: 'json',
})
);
}
getData().then(function(resp) {
$.each(resp.feed.entry, function(index, item) {
console.log(item.gsx$professionalorstatutorybody.$t);
});
});