Rouz Rouz - 6 months ago 4x
Javascript Question

Ajax POST data array is always empty

I am having a slight problem with ajax and Java servlet.

url: 'sampleURL',
type: 'POST',
success: function(response){ },
error: function(){}

My data object is made like this


My vars array exists, and is not empty.

When i try to do this thing in servlet

System.out.println(request.getParameter("name")); //it does print name

But when I try to print parameter vars it is always null.

Where did I go wrong?


Well It is a bit weird for this to be needed but if I created object like this


Param vars is not null anymore and I can use it as JSON