I have links which I want to do different things depending on the link. Therefore I have a datastructure:
var data = [{"name":"foo", "onClick":"baz()"}, {"name":"bar", "onClick":"bam()"}];
Currently, in the view i have a function run which takes the item and does eval(item.onClick), and that works, just it feels like a security hole.
I could put the onClick into the html when rendering the view, but that feels wrong.
Does anyone know of a way to do this?
You can embed function in the data
You can look here for more helpful stuff how to do it