jquery form submit wait for response code example
Example 1: put form action jquery
$('#button1').click(function(){
$('#formId').attr('action', 'page1');
});
$('#button2').click(function(){
$('#formId').attr('action', 'page2');
});
Example 2: when a form is subbmited jquery
$("#myform").submit(function(e) {
})