-1

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.

1

1 Answer 1

-1

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");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.