I’m using the advanced-http cordova plugin. Followed all their steps in their github repo (https://github.com/silkimen/cordova-plugin-advanced-http#post)
But when I try to run my code an error pops up:
missing mandatory "onFail" callback function
Here’s how my code looks like:
cordova.plugin.http.post('http://127.0.0.1:5000/api/register', {
username: this.username,
password: this.password,
firstname: this.firstname,
middlename: this.middlename,
lastname: this.lastname,
birthday: this.birthday,
age: this.age,
contact: this.contact,
address: this.address,
prisoner: this.prisoner
}, response => {
try {
response.data = JSON.parse(response.data);
// prints test
console.log(response.data.message);
} catch(e) {
console.error('JSON parsing error');
}
}, response => {
// prints 403
console.log(response.status);
//prints Permission denied
console.log(response.error);
});
What am I missing here? Please help