Created
February 10, 2020 11:59
-
-
Save vlzhr/b2b455a4de8e19d44ccff03b90478dfe to your computer and use it in GitHub Desktop.
certificado example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkData() { | |
const text = document.querySelector(".data").value.split("\n")[0]; | |
const certificateId = text.split(" ")[0]; | |
const xhr = new XMLHttpRequest(); | |
xhr.open("GET", "https://testnodes.wavesnodes.com/addresses/data/3N6EmqqQ1pZderX8sNMrfVuEo85ocPoqs2M/"+certificateId); | |
xhr.onload = function() { | |
const doesExist = JSON.parse(xhr.response).value === text; | |
document.querySelector(".result").innerHTML = doesExist ? "<span style='color: green'><strong>certificado</strong> exists</span>" : "<span style='color: red'><strong>certificado</strong> does not exist</span>"; | |
return doesExist; | |
}; | |
xhr.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks