K
K
kpkkk4232020-04-25 01:37:56
AJAX
kpkkk423, 2020-04-25 01:37:56

How to parse via XMLHttpRequest?

How to get the element I need from the page?

var xhr = new XMLHttpRequest(); 
xhr.open('GET', '/change_pw', false);
xhr.onload = function () {
hash = document.getElementsByName("hash")[0].value.innerHTML = xhr.responseText;
};
xhr.send();
alert(xhr.hash);

I need to get in the hash console
the html page itself that opens
<input type="hidden" name="hash" value="9f396fe44e7c05c16873b05ec425cbad">

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-04-25
@kpkkk423

To get started https://learn.javascript.ru/xmlhttprequest
And this is
https://learn.javascript.ru/function-basics

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question