I am developing a javascript menu (using jQuery).
As an example, the below is the structure of the items object I would pass to my custom function which then creates the menu.
var items = {
0: {
name: 'file',
submenu: {
0: {
name: 'open',
hasSubitems: true,
subitems: {
0: {
name: 'file',
hasSubitems: false,
callback: function() { alert('you opened a file!'); }
},
1: {
name: 'project'
hasSubitems: false,
callback: function() { alert('you opened a project!'); }
}
}
},
1: {
name: 'exit',
hasSubitems: false,
callback: function() { alert('you logged out!'); }
}
}
},
1: {
name: 'edit',
submenu: {
...
}
}
}
I would like to be able to store the above into a database, including their prospective callbacks. I intend to create an interface to build the menus dynamically and such.
I realize I could create a JSON string and store it that way, but then what about the callback functions? I have been recommended against using eval several times, so in what other ways might people safely store this information in a database so it can be called upon later?
.jsfiles