Fetch implemented
This commit is contained in:
parent
62c0767e78
commit
da2e950007
1 changed files with 15 additions and 1 deletions
|
@ -38,7 +38,21 @@
|
||||||
} else {
|
} else {
|
||||||
object = { user: value };
|
object = { user: value };
|
||||||
}
|
}
|
||||||
alert(JSON.stringify(object));
|
fetch('https://api.account.skynet.ie/ldap/recover/password', {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(object),
|
||||||
|
mode: "cors"
|
||||||
|
}).then(res => {
|
||||||
|
if(res.status === 200){
|
||||||
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
|
||||||
|
} else if (res.status === 500){
|
||||||
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";
|
||||||
|
} else {
|
||||||
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Failed to communicate to server</span>";
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: yellow; color: black'>Please try again</span>";
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue