To get the html response of the page, I use:
var theUrl = "https://example.com/users/22";
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false );
xmlHttp.send();
var html = xmlHttp.responseText;
This will now return a 535 line html page. If we simply had that source code on our current page, to get the value of the tag (12345) as shown below:
<input name="token" type="hidden" value="12345" />
we would simply use:
document.getElementsByName("token")[0].value;
But since the HTML is in the ajax response as a variable named html how do I get the value of the input with name token? Can I somehow convert it to a DOM element and then run that code?
javascript only please, no jQuery.
Thanks.