json - How to use jQuery.getJSON() and print it in a bootstrap modal -


i'm student , real beginner jquery , want know how make jquery.getjson() read local file , print in modal (bootstrap)

here's local file (fruits.json)

{     name: “apple”,      image: “./img/imag_apple.jpg”,      description: “tasty apple”,      pricekg: 34,      taxes: 16,     number: 28 } {     name: “orange”,      image: “./img/imag_orange.jpg”,      description: “tasty orange”,      pricekg: 34,      taxes: 16,     number: 28 } {     name: “lime”,      image: “./img/imag_lime.jpg”,      description: “tasty lime”,      pricekg: 34,      taxes: 16,     number: 28 } 

you add grab data response of getjson() , add modal.

jquery.getjson(url, function (data) {   var jsonobj = json.stringify(data);   // add data modal }); 

demo


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -