I can’t solve the problem. I need to create a form, when I click on the buttons from the file on the server reads the name and surname and displays them in the HTML page (data will be taken from the input). The second form allows you to edit information about you and save it.
let form = document.forms.user
form.submit.addEventListener("click", sendRequest)
function sendRequest(e) {
e.preventDefault()
let formData = new FormData(form)
let request = new XMLHttpRequest()
request.open()
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
document.getElementById("output").INNERHTML = request.responsText
}
}
request.send(formData)
}
I do not know how to implement all the above functionality. Help me please 🙂