How To : Get Javascript array on server side.

In order to pass an array from client to server, call the server following way with Ajax post call :



var myArray = ['1', '2'];
$.post('action.do', {arrayData:myArray, mode:"get"});

On server:

String[] arrayData=request.getParameterValues("arrayData[]");

This worked for me!
What about you?

0 nhận xét:

Đăng nhận xét