SharePoint 2013 get current user using JavaScript
Here is the code that worked for me: <script src=”https://stackoverflow.com/SiteAssets/jquery.SPServices-2013.02a.js” type=”text/javascript”></script> <script src=”/SiteAssets/jquery.js” type=”text/javascript”></script> <script type=”text/javascript”> var userid= _spPageContextInfo.userId; var requestUri = _spPageContextInfo.webAbsoluteUrl + “/_api/web/getuserbyid(” + userid + “)”; var requestHeaders = { “accept” : “application/json;odata=verbose” }; $.ajax({ url : requestUri, contentType : “application/json;odata=verbose”, headers : requestHeaders, success : onSuccess, error : onError }); function … Read more