How to send array values in a $.get call via jquery? -
let's have multiple text boxes array names, like:
<input type='text' name='test[]' class='test_tb' id='test1' value=''/> <input type='text' name='test[]' class='test_tb' id='test2' value=''/>
now if using form, serialize , send it, want know how build manually. tried like
$.get('test.php',{ 'test[]':$("#test1").val(), 'test[]':$("#test2").val() },function(d){ console.log(d); });
but since object can't have repeating keys, didn't work...so manual way of doing this?
ps: learning purpose not actual task.
try
$.get('test.php',{ 'test[]':[$("#test1").val(), $("#test2").val()] },function(d){ console.log(d); });
Comments
Post a Comment