SharePoint 2013 REST call - Get Current User
function getCurrentUser ( ) { var ajax = $ . ajax ( { url : _spPageContextInfo . siteAbsoluteUrl + "/_api/web/currentUser" , method : "GET" , headers : { "Accept" : "application/json; odata=verbose" } , error : function ( data ) { console . log ( data ) ; } } ) ; return ajax ; } function getUserGroups ( userId ) { var ajax = $ . ajax ( { url : _spPageContextInfo . siteAbsoluteUrl + "/_api/web/GetUserById('" + userId + "')/Groups" , method : "GET" , headers : { "Accept" : "application/json; odata=verbose" } } ) ; return ajax ; } getCurrentUser ( ) . done ( function ( userId ) { getUserGroups ( userId . d . Id ) . done ( function ( groups ) {