I am struggling to write certain attributes to HTML using a recursive loop and I can't seem to get the code to work properly.
The JSON data consists of an array of hashes with the following attributes: serno (serial number), parent_serno (serial number of parent), and name (name of the attribute). My goal is to first display each hash.name where "parent_serno == 0" and then, for each one, list the names of hashes where "parent_serno = serno(of the first hash)" to group them accordingly based on serno and parent_serno.
Can anyone help me identify what I'm doing wrong?
var dataBase = [{"serno": 1, "parent_serno": 0, "name": "Home"},
{"serno": 2, "parent_serno": 0, "name": "Search"},
{"serno": 10, "parent_serno": 2, "name": "Search Payment"},
{"serno": 11, "parent_serno": 2, "name": "Problematic Search Payment"},
{"serno": 12, "parent_serno": 2, "name": "Cash Error"},
{"serno": 13, "parent_serno": 2, "name": "Payment Note"},
{"serno": 89, "parent_serno": 2, "name": "Search Payment By Category"},
{"serno": 131, "parent_serno": 2, "name": "Search Payment New"},
{"serno": 3, "parent_serno": 0, "name": "User Mangement"},
{"serno": 4, "parent_serno": 0, "name": "Service Provider"},
{"serno": 5, "parent_serno": 0, "name": "General"},
{"serno": 88, "parent_serno":...