In the process of creating a small webpage, I have designed 2 navigation panels - one on the left and one on the right.
The leftNav panel contains a list of different flower names.
While the rightNav panel displays images corresponding to each flower.
An example layout is shown below:
|'''''''''''''''|''''''''''''''''''''''''''''''''''''''|
| | Pics of Flower1 |
| |'''''''| | |'''''| |'''''| |
| |flower1| | | A | | C | |
| | |.....| |.....| |
| |'''''''| | |
| |flower2| | |
| | |'''''| |'''''| |
| |'''''''| | | B | | D | |
| |flower3| | |.....| |.....| |
| | |
|...............|......................................|
As I move towards making this page data-driven, I am faced with the challenge of retrieving data from a database for rendering. How can this be done most efficiently?
My current approach involves creating a JSON object structured like this:
var data = {
"Lotus" : [ "a1.jpg", "a1.jpg", "a1.jpg", "a1.jpg" ],
"Orchid" : [ "o1.jpg", "o1.jpg", "o1.jpg", "o1.jpg" ],
"Tulip" : [ "t1.jpg", "t1.jpg", "t1.jpg", "t1.jpg" ],
"Rose" : [ "r1.jpg", "r1.jpg", "r1.jpg", "r1.jpg" ],
};
Do you think this is an effective method? Any suggestions for a better approach?