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


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


          網站導航:
           
          主站蜘蛛池模板: 郯城县| 四会市| 榆社县| 富锦市| 林甸县| 准格尔旗| 朝阳区| 恩施市| 乌兰浩特市| 府谷县| 云和县| 丽江市| 三明市| 晴隆县| 山阴县| 万年县| 九龙县| 晋城| 封丘县| 黄平县| 那曲县| 鄂伦春自治旗| 萨迦县| 墨玉县| 十堰市| 邳州市| 奉化市| 大丰市| 凤翔县| 德保县| 德州市| 东乌珠穆沁旗| 平潭县| 拉孜县| 垣曲县| 犍为县| 柳江县| 积石山| 重庆市| 胶州市| 东明县|