D
D
drtvader2016-02-15 12:17:53
JavaScript
drtvader, 2016-02-15 12:17:53

How to set conditions for the output of certain blocks from JSON?

Hello! There is json and there is a script, there are different blocks (product reviews with and without comments). How to write in a script that, depending on the content, exactly the block that is specified there would be loaded in JSON?
My JSON:

{
  "review": [
    {
            "id": "1",
      "foto": "/images/content/avatar-review.jpg",
      "name": "Rosa",
      "text": "ТЕКСТ.",
      "star": "3",
      "date": "22.10.2015 17:21"
    }
   ]
}

JSON does not yet contain data for the block with comments. Tell me how to be? What do I need to do next? What is the condition?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question