I want to code a single js/jquery function for all forms submit events in my application.
Currently I am hardcoding on 3 locations like that and it is working but I have to create a function for each form separately:
jQuery('#myForm').live('submit',function(event) { // #myForm hardcoded here
$.ajax({
url: 'one.php', // one.php hardcoded here
type: 'POST',
data: $('#myForm').serialize(), // #myForm hardcoded here
success: function( data ) {
alert(data);
}
});
return false;
});
Thanks