I have the following code in Javascript:
jQuery(document).ready(function(){
var actions = new Object();
var actions;
actions[0] = 'create';
actions[1] = 'update';
for (key in actions) {
// Dialogs
var actions[key]+Dialog = function(){
$('#'+actions[key]+'dialog').dialog('destroy');
$('#'+actions[key]+'dialog').dialog({
resizable: false,
height:600,
width:400,
modal: true,
buttons: {
Cancel: function() {
$(this).dialog('close');
}
}
});
};
}
});
I want to create 2 functions in loop(createDialog and updateDialog). How can i do this? In PHP there is very simple $$var. But how make variable variable in JS I don't know.
Thank you