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


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


          網站導航:
           
          主站蜘蛛池模板: 临湘市| 祁阳县| 通河县| 根河市| 眉山市| 海伦市| 象州县| 塔城市| 淳安县| 东莞市| 特克斯县| 绥中县| 张家港市| 耒阳市| 二手房| 卢龙县| 汽车| 交城县| 奉化市| 盐山县| 永靖县| 英吉沙县| 天气| 奉节县| 阿城市| 繁峙县| 观塘区| 霍山县| 辽宁省| 河北省| 钦州市| 永年县| 东明县| 富宁县| 抚顺市| 南通市| 太康县| 八宿县| 陇川县| 铜梁县| 林周县|