JSFiddle - React, Tailwind, and code Playground
by Dhanck
HTML
<div class="inner">
</div>
JavaScript
$.ajax({
url: 'https://prod.api.modist.twg.ca/api/v1',
dataType: 'jsonp',
jsonpCallback: 'jsonCallback',
type: 'get',
crossDomain: true,
cache: false,
success: function(data) {
$(data.product).each(function(index, value) {
console.log(value);
$("<li>" + value.name + "<img src='" + value.image + "' width='50px' height='50px' / >" + value.cost + "</li>")
.data("value", value) // save the value on the li.
.appendTo(".inner");
});
}
});
$(document).on("click", ".inner li", function() {
location = "http://home.jejaju.com/some.html?"+$.param($(this).data("value"))
})