I’m using jQuery to dynamically add new divs containing a few fields.
I’m adding new tunes in this example of output:
<div id="uploadedTunes">
<div class="tune">
Title:<input type="text" name="Title">
Length:<input type="text" name="Length">
</div>
<div class="tune">
Title:<input type="text" name="Title">
Length:<input type="text" name="Length">
</div>
</div>
Is there a way to serialize only the fields in the div uploadedTunes (and not the whole form) ?
And how do I serialize this so I have an array like this:
uploadedTunes{
tune {
Title=”highway to hell”,
Length=”03:01″
}
}
Thank you for your help or clues!
DEMO: http://jsbin.com/aneme/4/edit
include the jquery json lib
NOTE:
Most people think that serializeArray() work only with FORM, this is not exactly true, it can work also without form by giving to each element you want serialize the same class! then serialize this class instead of form!