I am encountering an issue with my mobile cordova application. When attempting to log in, I am facing the following error:
Error: JavaScript runtime error - Object doesn't support property or method 'error'
The error is being traced back to this specific block of code:
$.ajax({
url: url,
type: 'POST',
data: { domainName: domain, username: username, password: password, appId: appId }
})
.done(function (json) {
if (json.success) {
that.set("isLoggedIn", true);
token = json.token;
username = username;
isAuthenticated = true;
$('#show-Loader').hide();
window.location("#esig");
}
else {
navigator.notification.alert("No User Found", function () { }, "Login failed", 'OK');
//alert(json.error);
$('#show-Loader').hide();
return;
}
})
//The issue arises when calling the 'error' method on $.ajax()
.error(function (xhr, status, error) {
navigator.notification.alert('Unable to Connect to Server' + '\n' + ' Please check Settings.', function () { }, "Connection Failed", 'OK');
$('#show-Loader').hide();
});
},
I am wondering if anyone has insights as to why this particular JavaScript error is occurring. My intention is to prompt an error message indicating a connection failure while testing the functionality.