Pakalu Papito Pakalu Papito - 2 years ago 143
Javascript Question

JSON: output text using jquery

how to output a JSON format using javascript or jquery? like this

var info = {
"items": {
"phone" : [
"product" : "iPhone 8",
"manufacturer" : "Apple",
"releaseDate" : "2018",
"price" : 499

This is the mockup to be appear!

Thank you guys, you are blessed! :)

Answer Source

Loop through your phone items in your info.items object.

For each item, create a phone container and append it to the content

The phone properties can be accessed like this info.items[i].propertynamehere. Here is the example, you can style it how you want, and structure it how you want.

for (var i = 0; i <; i++) {
    var phone = "<div class='phone'>" +[i].product + "</div>";

This uses JQuery so make sure to include that as well. If you would prefer a pure Javascript implementation, let me know and I can provide.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download