Posted on 2010-07-14 11:46
董锐 阅读(734)
评论(0) 编辑 收藏
I know how to send by jquery post method $.post("test.php", { name: "John", time: "2pm" } );
but what if my form field name is array
<input type=text name="n1[]" id="n1[]" value='12345"> <input type=text name="n1[]" id="n1[]" value="14454">
how to send these 2 field value send to url by jquery post method?
You can pass in an array as a value in the object:
{name: 'John', 'nl[]': ['12345', '14454']}
(This is documented at ajax but also works for post.)
var fields = $(":input").serializeArray(); $.post("test.php",fields);
from:http://stackoverflow.com/questions/1656267/how-to-send-multi-field-value-by-jquery-post