Hello people I'm doing a web application some orthodox, my method is AJAX using java and javascript.
And I asking me if is possible set a array from javascript to Servlet.
Hello people I'm doing a web application some orthodox, my method is AJAX using java and javascript.
And I asking me if is possible set a array from javascript to Servlet.
Yes it is possible!
var test = [];
$.ajax({
type: 'get',
url: 'someurl',
dataType: 'JSON',
data: {
test: JSON.stringify(test)
},
success: function(data) {
},
error: function(data) {
alert('fail');
}
});
And in servlet:
String json = request.getParameter("test");