0

I am sending array from jQuery to Servlet.For table I am using Datatables API. The following is code snippet:

JQUERY:

$("#savePO").click(function(){

    var oTable = $('#npoGridView').dataTable();
    var  getdata = oTable.fnGetData()

    $.post("AddPO" ,{
        getData: escape(getdata)
    },
    function (data)
    {   
        alert(data);
    });


});

Servlet:

String []getResult = request.getParameterValues("getData");

Servlet receive all the data on index [0],(i.e. getResult[0] ), even number of row are more than one;

How can we resolve this issue?

Both FM
  • 770
  • 1
  • 14
  • 33

1 Answers1

0

You should use the traditional style of param serialization. Using $.ajax call you could simply do:

$.ajax({
  type: 'POST',
  url: "AddPO",
  data: escape(getdata),
  traditional: true,
  success: function (data)
    {   
        alert(data);
    }
});

References:

Community
  • 1
  • 1
Miguel Silva
  • 633
  • 5
  • 12