im trying to post a table which is a part of bigger form using jquery
<table>
<tr>
<td><input name=name[] value='sam' type='hidden' />Sam</td>
<td><input name=age[] value='16' type='hidden' />16</td>
</tr>
<tr>
<td><input name=name[] value='jesse' type='hidden' />Jesse</td>
<td><input name=age[] value='15' type='hidden' />15</td>
</tr>
</table>
im trying to post this table using jquery
$('#Sx_apply').click(function(){
var vals={};
$('table').find('input[type="hidden"]').each(function(){vals.push($(this).val());})
$('<div>').load($(this).data('apply'),vals);
});
but my question is how to push key=input name with the input value.
i tried vals[$(this).attr('name')] = $(this).val();
but since all tr's have same name (array post) they overwrite each others.