Solution
- function getUserById() {
- var context = new SP.ClientContext.get_current();
- var user = context.get_web().get_siteUsers().getById('1073741823');//Give the user id here
- context.load(user);
- context.executeQueryAsync(
- Function.createDelegate(null, ensureUserSuccess),
- Function.createDelegate(null, onFail)
- );
- function ensureUserSuccess() {
- //You can access the properties here
- alert(user.get_title());
- alert(user.get_loginName());
- }
- function onFail() {
- alert('Fail');
- }
- }