[jQuery] passing args to a delegate

[jQuery] passing args to a delegate


Hello,
I have the following code:
var registerImageForms = function(id, key, type) {
var sizes = ['small', 'medium', 'large'];
$('#panel-images fieldset:visible').remove();
$.each(sizes, function(i, item) {
var $clonedForm = $('#panel-images fieldset:hidden').clone();
$("legend", $clonedForm).text(item);
$("[name='id']", $clonedForm).val(id);
$("[name='key']", $clonedForm).val(key);
$("[name='type']", $clonedForm).val(type);
$("[name='size']", $clonedForm).val(item);
$("img", $clonedForm).attr('src', "/imagem/article/" + key +
"/" + item + ".png");
$("#panel-images").append($clonedForm);
$("form", $clonedForm).ajaxForm({
success: registerImageForms
});
$clonedForm.show();
});
};
Success has no args, so everything is rendered empty, after posting
the form. If I pass arguments as
success: registerImageForms(id, key, type)
The browser crashes and it makes sense, because at the time this
fires, these identifiers mean nothing. But how do I pass them?
--
Jan