Trying to parse error_code tag in my client web app which uses angularjs. My web service returns the login response in xml format.
response xml is in response.data. The attached code is controller for login form.
var app = angular.module("myApp", []);
app.controller("loginController", function($scope, $http) {
$scope.myFunc = function ()
{
$http.get("http://localhost:8080/LocWebService/rest/authorize/"+
$scope.Name+"_"+$scope.Password)
.then(function(response) {
var response_code=response.data.getElementsByTagName("error_code")
[0].childNodes[0].nodeValue;
if (response_code=="1")
alert("User Name is wrong.");
if (response_code=="2")
alert("User Password is wrong.");
if (response_code=="0")
alert("Login is successful.");
});
}
});
No error messages.Expected behavior is that appropriate alert is displayed according to error_code.