Rouz Rouz - 2 years ago 98
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download