I have something like :
var myMenu= [
{
'My English Title':function(menuItem,menu)
{ ... }
}];
Now, I want the replace 'My English Title' by an other JSON structure value LOC.MENU_TITLE
.
I have try:
var myMenu= [
{
LOC.MENU_TITLE:function(menuItem,menu)
{ ... }
}];
But it doesn't work. Any one can give me an hint of how to get JSON value inside a JSON variable?
Edit:
This is to use the Context Menu of Jquery but I got a problem with all solutions below and it's when it's time to pass the String for the Separator. It doesn't show the separator because it pass the string into an object instead of just the string.
Example:
var menu1 = [
{'Option 1':function(menuItem,menu) { alert("You clicked Option 1!"); } },
$.contextMenu.separator,
{'Option 2':function(menuItem,menu) { alert("You clicked Option 2!"); } }
];
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…