Wednesday, October 28, 2015

How to get login user id using SPServices

<script>
$().SPServices({
operation: "GetUserProfileByName",
async: false,
AccountName: $().SPServices.SPGetCurrentUser(),
completefunc: function (xData, Status) {
$(xData.responseXML).find("PropertyData > Name:contains('Name')").each(function() {
Name = $(this).parent().find("Values").text();
alert(Name);
});
}
});
  });
  </script>
In this code we have get all user details propertyData.
$(xData.responseXML).find("PropertyData > Name:contains('Name')").each(function() {
Name = $(this).parent().find("Values").text();
alert(Name);
});

No comments:

Post a Comment