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

          ajax post 數(shù)組

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


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 盐边县| 泊头市| 洛阳市| 安吉县| 光山县| 沾益县| 阳泉市| 湟中县| 上思县| 长汀县| 望奎县| 固阳县| 潼南县| 都昌县| 甘肃省| 青州市| 玉溪市| 五寨县| 安宁市| 东乌珠穆沁旗| 泸水县| 太和县| 新安县| 台南市| 曲沃县| 山西省| 安达市| 拜城县| 鄯善县| 肥乡县| 阿拉善右旗| 英山县| 郴州市| 宁乡县| 平远县| 金湖县| 巴林右旗| 库伦旗| 精河县| 阳东县| 龙江县|