Consider the code snippet below:
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var responses = JSON.parse(this.responseText);
var email = document.getElementById("email").value;
var passwordIs = responses.email; // email should be replaced with the user's input value;
document.write(passwordIs);
}
};
xmlhttp.open("GET","https://example.com", true);
xmlhttp.send();
Is there a way to modify the code so that when a user enters an email address, it is automatically substituted in place of the original email stored in the variable passwordIs
?
In simpler terms, if a user inputs
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d5bfb1bab095b0adb4b8a5b9b0fbb6bab8">[email protected]</a>
, the variable passwordIs
should reflect this: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="51233422213e3f2234227f3b3e34113429203c213d347f323e3c">[email protected]</a>
However, currently it displays as responses.email
.