Application contains different sections with many form fields in different sections.
I have to update the each section separately using ajax.. How to submit the specific section fields using ajax???
Here All the sections are in a single form..
As follows..
<form>
Section A:
<some fields>
Section B:
<some fields>
.......
</form>
If i submit form using ajax, It is sending all form fields.. But i'm saving specific section at once..
Any way to implement this requirement???
Thanks in Advance..
You've stated that you are able to submit the whole form with Ajax, therefore I'll assume you don't need help with writing the $.ajax()
(or $.post()
or whatever) itself, you just need to know about how to get the values from certain fields.
You can use multiple forms, one per group - to me this seems like the easiest way, though it won't work if you also need to be able to submit all the fields at once (perhaps to allow for browsers with JS turned off).
Or you can use the .serialize()
method on just the fields of a particular section. Either give the fields a class that identifies them as belonging to a particular section and use $(".sectionClass1").serialize()
or put the fields in some other sort of container, perhaps a <fieldset id="section1">
, and select accordingly with $("#section1 :input").serialize()
.
Couple of ways that I can suggest
Example Gist of multi form
Then you could use regular JQuery to serialize and submit values
$("#form1").serialize()
$("#form2").serialize()