javascript - jQuery Get value from multi dimensional arrays -
i can't find match question,
i have task of getting values elements
card record 1 : <input type="text" name="card[][company]" /> <input type="text" name="card[][bank]" /> <input type="text" name="card[][hospital]" /> card record 2 : <input type="text" name="card[][company]" /> <input type="text" name="card[][bank]" /> <input type="text" name="card[][hospital]" />
i want values can pass on controller via ajax (ci)
[0] card[0][company] = abc card[1][bank] = def card[2][hospital] = ghi [1] card[0][company] = abc card[1][bank] = def card[2][hospital] = ghi
i have tried $.each .push , .map can't figure out right manipulation, jquery answers please.
well, can this
var arr = $('input[name^=card]').map(function(){ homecoming { this.name : this.value } }).get(), newarr = []; while(arr.length > 0) newarr.push(arr.splice(0 , 3));
newarr
contain want.
javascript jquery arrays
No comments:
Post a Comment