Is it possible to put a function that returns a promise inside a click handler
Kind of like so,
$('#sbItems a').on('click', function (e) {
e.preventDefault();
// Do stuff
urlId = stuff;
function citeAjax(urlId) {
return $.ajax({
type: 'GET',
url: 'https://www.sciencebase.gov/catalog/itemLink/' + urlId + '?format=jsonp',
jsonpCallback: 'getSBJSON',
contentType: "application/json",
dataType: 'jsonp'
});
}
});
can I then use
citeAjax.done(function(json) {
alert(json.id);
}); ???