Using a $.post to submit all fields within a certain area (divs?)
I want to do a partial submit using Ajax on a page that has a global
submit. The global submit works with a form wrapping the entire page
and a global submit button at the bottom. This is fine, but I also
want a more granular submit functionality, such that there are Save
buttons that a user can hit within a certain area to only save that
area's data. I want to implement this using $.post. This can be done
easily by explicitly writing each and every form element name and
grabbing it by it's id to post to the back-end...however I was
wondering if there was a more abstract way, such as:
<div id="partialForm1">
<input type="text" id="field1">
<input type="text" id="field2">
<input type="text" id="field3">
<input type="text" id="field4">
<input type="text" id="field5">
<input type="button" onclick="$.post('<enter cgi name>', { away to
grab every element within my divid=partialForm1" without explicitly
stating input1: $('#input1).val(), etc.?} );">
Any thoughts or suggestions?