i have page multiple forms on each containing 1 submit button. when button pressed, need use data various hidden elements on form.
passing data via ajax working me using code this...
$("body").on("submit", "form", function (event) { var pm = $(this).serialize(); event.preventdefault(); $.post( 'urota3.php?' + pm ) .....
the data correct form passed urota3 , well.
but...
need use data in event function , i'm not sure how @ it. had tried adding data section this....
$("body").on("submit", "form", { id: $('input:hidden[name=id]').val() }, function (event) {...
but of course picks data first form on pade, not 1 button pressed.
how can reference piece of data correct form?
thanks
steve
$("body").on("submit", "form", function (event) { var pm = $(this).serialize(); pm[id] = $(this).find('input:hidden[name='+id+']').val(); event.preventdefault(); $.post( 'urota3.php?' + pm )
Comments
Post a Comment