P
P
parkito2016-10-23 19:45:10
JavaScript
parkito, 2016-10-23 19:45:10

How to get data from javascript in servlet?

Hello. Help, please, to solve a problem. Given the page jsfiddle.net/parkito/7eozjym1/1
After entering data into the fields and clicking on the send button, I need the contents of the fields to go into the servlet array. I do not quite understand how to extract data from this javaScript and send it to java.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mipan, 2016-10-24
@mipan

In general, to send a form, it is enough to specify the method (post / get) and action - the actual link to the servlet.
And all inputs from this form will go to the specified servlet.
If necessary in js, then on click call a function in which to send an ajax request to a servlet

$.ajax({
            method: "POST",
            url: "/servlet",
            data: {
                parav1: value1,
                param2: value2
            }
        })

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question