I have created a sample application in Oracle JET
which would route to the homepage upon login.
I want to validate the user credentials(username and password) with the table in the database using RESTful
web services and only upon successful validation I want the application to be routed to the homepage.
Since I am new to Oracle JET
and have less knowledge about integrating and validating user input with the data in the database, it would be a great if someone could help me with this. Thank you.
You can use ajax method to call restful web services.
Here is an sample that can help you.
self.username = ko.observable("");
self.password = ko.observable("");
self.login = function(data, event)
{
$.ajax({
url: "https://restservicesforlogin?username="+self.username()+"&userpwd="+self.password()+"",
type: 'GET',
headers: {
your headers Details
},
success: function(data)
{
if(self.ERROR_CODE()=='S')
{
oj.Router.rootInstance.go('homePage');
}
if(self.ERROR_CODE()=='E')
{
alert("Invalid username/password");
self.isLoggedIn(false);
}
},
error: function(jqXHR, exception)
{
alert("Internal Server Error") ;
}
})
}