亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

JS傳遞對象數(shù)組為參數(shù)給后端,后端獲取的實例代碼

 更新時間:2016年06月28日 09:46:37   投稿:jingxian  
下面小編就為大家?guī)硪黄狫S傳遞對象數(shù)組為參數(shù)給后端,后端獲取的實例代碼。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

前端JS代碼:

  var conditons = [];
  var test1 = new Object();
  test1.name="1";
  test1.id="2";
  var test2 = new Object();
  test2.name="1";
  test2.id="2";
  conditons.push(test1);
  conditons.push(test2);
  $(function(){
    $.ajax({
      async:"false",
      type:'post',
      url:'鏈接', 
      data:{name:"123",conditions:JSON.stringify(conditons)},
      dataType : 'json', 
      success:function(data){
        console.log(data);
      },
      error: function (XMLHttpRequest, textStatus, errorThrown){
        alert("error");
      }
    });
  });

重點注意:將對象數(shù)組轉(zhuǎn)為JSON形式的字符串:JSON.stringify

后端獲?。?/strong>

String conditions = request.getParameter("conditions");
JSONArray conditionList = JSONArray.fromObject(conditions);

以上就是小編為大家?guī)淼腏S傳遞對象數(shù)組為參數(shù)給后端,后端獲取的實例代碼全部內(nèi)容了,希望大家多多支持腳本之家~

相關文章

最新評論