javascript - Posting a form of variable length per jquery AJAX -
it might pretty simple, can't find out problem (i'm pretty new jquery ajax)
so here's want do.
i have form user can add together number of input fields. sent .php returns result out of submitted. means can't know length of $_post beforehand (and don't want to).
everything found far works manually entering fields ajax request
// values elements on page: var $form = $( ), term = $form.find( "input[name='s']" ).val(), url = $form.attr( "action" );
(from jquery api) work if know how many fields there be. want fields (no matter how much there added) posted..
is possible loop through fields? or send normal $_post posted without ajax?
sorry if it's stupid question :( regards
you want utilize jquery's .serializearray() or .serialize() depending on how php expects data.
the difference .serializearray() creates json array while .serialize() creates standard url-encoded key/value pairs.
javascript php jquery ajax forms
No comments:
Post a Comment