get JSON information into html control with javascript code example
Example: get JSON information into html control with javascript
var url = "https://raw.githubusercontent.com/mspanish/playground/master/jessica.json";
$(document).ready(function(){
$.ajax({
url: url,
dataType: 'json',
error: function(){
console.log('JSON FAILED for data');
},
success:function(results){
var cartItemsList = document.getElementById("cartItemsList");
results.basket.productList.forEach(function(element) {
cartItemsList.insertAdjacentHTML( 'beforeend',"<li>" + element.product.name + " : " + element.price+ " </li>");
});
}
})
})