Set up an object literal of possible actions:
var actions = {
action1: function(elem) {
$(elem).closest('form').submit();
...
},
action2: function(elem) {
var url = $('#url_field').val();
$('.display').load(url);
...
}
}
, ( ) . ('$.live()'), , .
$('input[type=button]').live('click', function(e){
actions[$(this).attr('id')](this);
});
"actions" (, , , , ).
URL- ajax . "repost [ing] form", , , , .
, .