Skip to content

Instantly share code, notes, and snippets.

@ImreC
Created February 17, 2018 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ImreC/754332b3f17af8baa82a90ea1b44c063 to your computer and use it in GitHub Desktop.
Save ImreC/754332b3f17af8baa82a90ea1b44c063 to your computer and use it in GitHub Desktop.
<html>
<body>
<p id = "info">
Sending token
</p>
<script>
var url = new URL(window.location.href);
var token = url.searchParams.get("token");
var obj = {
action: 'verifySignupLong',
value: token
}
console.log(JSON.stringify(obj))
console.log(obj)
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 201) {
// Typical action to be performed when the document is ready:
document.getElementById("info").innerHTML = 'Verification Successful for action <b>' + obj.action + '</b> and token <b>' + obj.value + '</b>';
} else {
document.getElementById("info").innerHTML = xhttp.response
}
};
xhttp.open('POST', 'http://localhost:3030/authmanagement' , true);
xhttp.setRequestHeader('Content-Type', 'application/json');
xhttp.send(JSON.stringify(obj));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment