Hi there
I am getting this response in REST web services
“{“userName":“ExampleName”,“userMob”:“8789878908”,“userCategory”:“HR”,“userDept”:“null”,“userSubDept”:“null”,“userEmail”:"examplename@gmail.com”,“userImage”:“E:/My Projects/College Management System/Registerd Users Images/Employee/Example Name.jpg”}”
And I am processing this JavaScript like this
$("#userName").text(data.userName);
$("#userMob").text(data.userMob);
$("#userEmail").text(data.userEmail);
$("#userCategory").text(data.userCategory);
if(!data.userDept){
$("#userDept").text(" ");
}else{
$("#userDept").text(data.userDept);
}
if(!data.userSubDept){
$("#userSubDept").text(" ");
}else{
$("#userSubDept").text(data.userSubDept);
}
$("#userImage").attr('src',"http://localhost:8089/CollegeManagementSystem /displayimage?imagePath="+data.userImage);
console.log("User Image is:"+data.userImage);
<div id="left_block" style="float: left;">
Name:<label id="userName">Name is Here</label><br>
Mob:<label id="userMob">Mobile Number is Here</label><br>
Email:<label id="userEmail">Email is Here</label><br>
Category:<label id="userCategory">Ctegory is Here</label><br>
Dept:<label id="userDept">Department is Here</label><br>
Sub Dept:<label id="userSubDept">Sub Dept is Here</label>
</div>
<div id="right_block" style="float: right;">
<img src="" alt="Image is Here" width="70%" id="userImage"></img>
</div>
my Intention is to if some value is null in REST web services then set that field to " " rather then showing null infront of them
How can I acheive this?
Thanks