How to code a general js function for all form submit events?

vatrogasac

New Member
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:\[code\]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;});\[/code\]Thanks
 
Back
Top