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

          ajax post 數組

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


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


          網站導航:
           
          主站蜘蛛池模板: 山丹县| 淮北市| 女性| 玉环县| 田东县| 洛南县| 泾川县| 甘泉县| 南乐县| 靖宇县| 兴隆县| 南岸区| 哈尔滨市| 岳普湖县| 惠水县| 南皮县| 仁怀市| 苏尼特左旗| 焦作市| 安新县| 涡阳县| 元谋县| 永泰县| 宁津县| 苍溪县| 扎囊县| 娱乐| 张家川| 宁波市| 内丘县| 平定县| 营口市| 牡丹江市| 肇源县| 张北县| 张掖市| 丹巴县| 嘉禾县| 吴江市| 子长县| 浠水县|