W
W
W1zzyy2022-03-06 21:28:20
JavaScript
W1zzyy, 2022-03-06 21:28:20

How to send data from a form and then write it to a variable?

I need to get data from an input field (html), then send it to the server and the server should write it to a variable. Perhaps the question is easy, but I did not find anything on the Internet, and I'm a beginner

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kapp1, 2022-03-06
@W1zzyy

Make a form in HTML, read js data from it on a trigger, form a POST request and send it to the server in JSON format via fetch or XHR, there the lisner will parse the request body and turn it into an object and assign it to a variable (either in the field of the object, or in map).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question