I am trying to get the first name of the user in the ajax method and trying to print it on the html page but it is not getting printed
this is my html:
<div ng-app="app" ng-controller="VolController">
<div class="account-action">
<h3 style="display:inline;"><img class="img" align="left" src="images/u11.png">
<p style="color:white"> Welcome {{first_name}}<p></h3>
</div>
this is my controller:
app.controller('VolController',['$scope','$sessionStorage','$state',function($scope,$sessionStorage,$state){
var b=sessionStorage.getItem("userid");
var a="http://localhost:8080/volunteers/"+b;
$.ajax({
type:'GET',
url:a,
success:function(data){
console.log(JSON.stringify(data));
$scope.volunteer=data;
$scope.first_name=JSON.stringify($scope.volunteer.VolunteersDTO.first_name);
console.log(data);
},
error:function(data){
alert(data);
},
dataType:"json",
contentType:"application/json",
})
}]);
Question Updated!!!!