JSFiddle - React, Tailwind, and code Playground
HTML
<ol>
<li>Jaws</li>
<li>The Lord of the Rings</li>
</ol>
JavaScript
function getYear(title)
{
$.ajax({
url: "http://www.imdbapi.com/?t=" + $(title).text(),
dataType: 'json',
success: function(data){
var year = data.Year;
var text = $( this ).text();
$(title).append(" ("+year+")");
}
});
}
$( "li" ).each(function() {
getYear(this);
});