I need to call a jQuery function with EVAL (but I don't know how to do it), then I solve with this solution, but I don't think that this is the correct way...
<script>
jQuery.fn.customfunction = function (data) { alert( data ); }
</script>
<div id="eval_div"></div>
<form><input role="button" myFunction="customfunction"/></form>
<script>
$('[role=button]').click( function() {
var button = this;
$.post( "/action",
$(form).serialize(),
function (data) {
$('#eval_div').html( "<script>" + $(button).attr('myFunction') + "('" + data + "');</script>" );
} );
});
</script>
customfunction is a general function for each form, each form has a different CUSTOMFUNCTION with different name, by this reason, the button has the name of the function.