var forgotPasswordClickEvt = document.getElementById('forgotPasswordClickEvt');
forgotPasswordClickEvt.addEventListener('click', forgotPasswordClicked);
function forgotPasswordClicked(event) {
event.preventDefault();
var data = "email=" + document.getElementById('email').value;
ajaxCall(data, "http://localhost:3000/v1/auth/forgot_password", function(status, response) {
if (status == 200) {
alert('successfully sent');
} else {
alert('Error', status)
}
});
}
function ajaxCall(data, url, callback) {
var xhttp = new XMLHttpRequest();
xhttp.open("POST", url, true);
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
return callback(this.status, JSON.parse(xhttp.response));
}
}
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send(data);
}
</script>should I send data in json format?
I get following error in express API
POST /v1/auth/forgot_password 500 2.246 ms - 3467
Error: No default engine was specified and no extension was provided.
:'(
PLEASE just use fetch
https://stackoverflow.com/questions/23595282/error-no-default-engine-was-specified-and-no-extension-was-provided
pls next time use some bin to paste the code :)
Обсуждают сегодня