Skip to content

Instantly share code, notes, and snippets.

@vineethvijayan
Last active August 6, 2021 05:28
Show Gist options
  • Save vineethvijayan/e6ca5e2d6bec2eb9f19f44bc3a663128 to your computer and use it in GitHub Desktop.
Save vineethvijayan/e6ca5e2d6bec2eb9f19f44bc3a663128 to your computer and use it in GitHub Desktop.
carl-pete-eral
// Here You can type your custom JavaScript...
var a;
const userAction = async () => {
const response = await fetch('https://sheltered-depths-74912.herokuapp.com/getUser');
const myJson = await response.json(); //extract JSON from the http response
// do something with myJson
a = myJson
console.log(myJson)
var email = myJson["email"]
if (email === undefined || email === null) {
email = myJson[""]
}
var address = myJson["address"]
if (address === undefined || address === null) {
address = myJson["_1"]
}
document.getElementsByClassName('form_item ')[0].value = email
document.getElementsByClassName('form_item ')[1].value = address
document.getElementsByClassName('form_item ')[2].value = address
//set timeout
setTimeout(function(){
document.getElementById("entry-form").submit();
setTimeout(() => {
window.close('','_parent','');
}, 1000);
}, 2000);
}
userAction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment