I have this HTML
<select class="form-control" required name="article">
<option value="Coca Cola">Coca Cola</option>
</select>
<input class="form-control number-input" value="" name="qty" type="text">
<select class="form-control" required name="article">
<option value="Jupi">Jupi</option>
</select>
<input class="form-control number-input" value="" name="qty" type="text">
<select class="form-control" required name="article">
<option value="Fanta">Fanta</option>
</select>
<input class="form-control number-input" value="" name="qty" type="text">
And
JS
var invoiceNumber = 1;
var articles = $('[name~=article]').map(function () {
return $(this).val()
}).get();
var qty = $('[name~=qty]').map(function () {
return $(this).val()
}).get();
What i need is to get new JSON that will look like this
var invoicesGet = [{
"invoice": "1",
"article": "Coca Cola",
"qty": "2042"
}, {
"invoice": "1",
"article": "Jupi",
"qty": "232"
}, {
"invoice": "1",
"article": "Fanta",
"qty": "45"
}]
This is working fiddle what i have for now: http://jsfiddle.net/b33kvd3L/
I think i got all elements value, order will be that way, but i dont know how to combine all this json to one, and add invoiceNumber? I dont know how many inouts will be added they are dinamicly add