Variable dialogbutton names

Variable dialogbutton names


Hi, this may be just me being bad at JS, but I got a dialog like this:
elm.dialog({
resizable: false,
title: (caller.title) ? caller.title : formElement,
buttons:{
'Ok' : function() {
var form = $("#" + caller.nodeId + " form");
var options = {
'beforeSubmit': function (data, form, options) {
$(elm).dialog('close');
delete(data.id);
return true;
},
'url':getMenuItemSavePointer(caller._id),
'type' : 'POST',
'dataType': 'json',
'success': onMenuItemSaveDone

};
form.ajaxSubmit(options);
},
'Close' : function() {
$(this).dialog('destroy');
}
}}
Sometimes I want the 'Ok' text to be 'Save', other times I want it to be
"Delete". How can I use a variable as a key to a hash?
This is a bit a general JS quesion, I'm sorry for that, but I have tried
to research this and haven't come up with a good way to do it.
Regards,
Tarjei