Need to grab user email from SharePoint people picker and show an alert. I have tried below options but unable to get an alert after adding the name in people picker.
var supervisorPicker = SPClientPeoplePicker.SPClientPeoplePickerDict['Reportee_x0020_Of_f56eef23-35a8-4afe-8ffe-3cbf6993a7ad_$ClientPeoplePicker']
supervisorPicker.OnValueChangedClientScript = function (peoplePickerId, selectedUsersInf)
{
var supervisorEmail = supervisorPicker.GetAllUserInfo()[0].EntityData.Email
showAlert(supervisorEmail);
};
and,
var sup = $().SPFindPeoplePicker({
peoplePickerDisplayName: "Reportee Of"
});
if(sup != undefined){
showAlert(sup.dictionaryEntries[0].Email);
}
my showAlert function is like this:
function showAlert(email){
$.ajax({
url: "http://xxxxxxx/DataService.svc/jsonData/"+email
}).then(function(data) {
alert(data.CL);
});
}
Let me know what I am missing, and how can I grab a people picker change event to call a function and show the alert.