Вот код моего кода: < /p>
const http = new XMLHttpRequest();
const url = 'http://page/';
http.open('get', url, false);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.onreadystatechange = function ()
{
if(http.readyState === 4)
{
if(http.status === 200 || http.status == 0)
{
let str = (http.responseText);
results = document.getElementById('test').value;
alert(results)
}
}
}
http.send();
< /code>
Как я могу сортировать STR в HTML, чтобы я мог получить значение, используя Document.getElementById? < /p>
i Пробовали < /p>
var doc = document.implementation.createHTMLDocument("example");
doc.documentElement.innerHTML = http2.responseText;
let test1 = doc.body.querySelector("#test").value;
< /code>
Это сработало, но дает мне пустое значение, и когда я посмотрел предварительный просмотр ответа, я обнаружил, что полоса значения пустой, а параметры похожи на статус по умолчанию завод. И когда я посмотрел в HTML -код страницы, обнаружил значение в этой строке < /p>
Transfer_meaning('test','\12345678');
Подробнее здесь: https://stackoverflow.com/questions/566 ... t-using-js