How to get POST data including the submitted button when submitting form in jQuery
The following example demonstrates how to get POST data of the entire form including POST data of the submitted button.
jQuery( 'form input[type=submit]' ).click( function( event ) { event.preventDefault(); currentForm = jQuery( this ).parents( 'form' ); currentFormPostArray = currentForm.serializeArray(); currentFormPostArray.push({ name: jQuery( this ).attr( 'name' ), value: jQuery( this ).attr( 'value' ) }); jQuery.post( currentForm.attr( 'action' ), jQuery.param( currentFormPostArray ) ).done( function( data ) { //code to work with received data }); });