posts - 48, comments - 13, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          ajax post 數組

          Posted on 2010-07-14 11:46 董銳 閱讀(743) 評論(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


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 固镇县| 邯郸市| 内黄县| 金阳县| 天门市| 襄樊市| 太白县| 镶黄旗| 扬州市| 东乌珠穆沁旗| 温泉县| 栾城县| 灯塔市| 调兵山市| 扬州市| 定州市| 左贡县| 化州市| 辽中县| 中西区| 隆林| 罗平县| 揭西县| 通榆县| 安塞县| 东山县| 凯里市| 石狮市| 鹤庆县| 大兴区| 周口市| 郁南县| 九龙城区| 当涂县| 分宜县| 永定县| 丹江口市| 噶尔县| 耿马| 虹口区| 崇礼县|