I have the below img tag :
<img alt="no pic to display" class="profile__image" id ="popupPic" />
I am trying to display a photo retrieved from ajax call :
photo looks like this in browser console : coded pic
this is my jquery that I have tried to use here :
var pic=(data.split("photo:")[1]).split("manager:")[0];
document.getElementById("popupPic").src ='data:image/png;base64, + pic';
the php file used to make the ajax call to active directory :http://pastebin.com/tSRxwQL8
I am able to display other attributes from the console such as title ,mail ,department etc by calling the jQuery as follows :
$('.leaderboard li').on('click', function () {
$.ajax({
url: "../popupData/activedirectory.php",
type: "POST",
data: {id:$(this).find('.parent-div').data('id')},
success: function(data){
console.info(data);
$('#popup').fadeIn();
var email=(data.split("mail:")[1]).split("title:")[0];
$('#emailOfUser').html('Email:'+ email);
var dept=(data.split("department:")[1]).split("manager:")[0];
$('#departmentOfUser').html('Department:'+ dept);
var pic=(data.split("photo:")[1]).split("manager:")[0];
$('#popupPic').append(pic);
},
error: function(){
alert('failed, possible script does not exist');
}
});
});
The browser console shows that an ajax call returns this :
<p> sn: xxxxxx<br/>givenname: xxxxx<br/>
employeeID: 0050<br/
>distinguishedName: CN=xxxx xxxxx,OU=Employees,OU=Accounts,OU=India,DC=asia,DC=xxxxxxx,DC=com<br/>
displayName: Mark Hewettk<br/>sAMAccountName: xxxxxxx<br/>
department: xxxxx<br/>manager: CN=xxxxxx xxxxxxx,OU=Employees,OU=Accounts,OU=India,DC=asia,DC=xxxx,DC=com
<br/>
mail: mhewettk@abc.com<br/>
title: xyz<br/>
photo :����%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz���������������������������������������������������������������������������
the problem is that I am unable to display the thumbnail photo i.e the photo tag above.
kindly help me on how to fetch the photo from the ajax data.