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

          ajax post 數組

          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


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


          網站導航:
           
          主站蜘蛛池模板: 广东省| 长海县| 彰化市| 晋宁县| 黄骅市| 彩票| 左贡县| 类乌齐县| 防城港市| 邓州市| 郓城县| 化德县| 梨树县| 临泽县| 靖西县| 涞水县| 芦山县| 宣武区| 获嘉县| 永年县| 华容县| 临漳县| 九江县| 平果县| 尉犁县| 宝坻区| 静乐县| 安图县| 乐业县| 浦北县| 咸阳市| 泸水县| 拜城县| 米林县| 鲁甸县| 米脂县| 新田县| 南澳县| 汝州市| 溧水县| 临安市|