Let's now design the jQuery code needed to consume this endpoint so that we can show these records on a web page and list our products available to buy. This should look as follows:
function LoadProducts() { // Load products' details. $.ajax({ url: 'http://localhost:57571/api/Productsdetails', type: "GET", contentType: "application/json", dataType: "json", success: function (result) { $.each(result, function (index, value) { $('#tblProducts') .append('<tr><td>' + '<h3>' + value.name + '</h3>' + '<p>' + value.description + '</p>' + '<a target="_blank" href=' + value.url + '>Amazon Link</a>' + '<input type="button" style="float:right;" class="btn btn-success" value="Add To Cart" />' + '</td></tr>'); }); } });}