I have a nodejs web service url. Through that I am able to perform authentication. I am using AJAX for that. I want to do the same operation with simple javascript.
This is my service.js code
var LOGIN_AUTHENTICATION = "http://192.168.84.88:8888/AD-Service/rest/getEmpDetails/authenticateUser";
this.getLoginAuthentication = function(taskObject) {
var promise = null;
if (!promise) {
promise = $http({
method: 'POST',
url: LOGIN_AUTHENTICATION,
data: taskObject,
headers: {'Content-Type': 'application/json'}
}).then(function(response) {
return response.data;
});
}
return promise;
}
This is my controller code..
ProjectServices.getLoginAuthentication($scope.loginData).then(function(data) {
if(data=="true"){
$state.go('app.calendar',{username:$scope.loginData.userName});
}
else{
$scope.myvalue = true;
$scope.loginData.password='';
}
});
can anybody please help me how to do this in simple javascript..?