Get Current web logged in User of a SharePoint site in jQuery:
Use the below snippet and just replace the jquery library URL and run on you SharePoint page.
<script src="../Assets/Jquery/jquery-1.9.1.min.js"></script><script >
function getCurrentLogInUser(){$.ajax({
url: _spPageContextInfo.webServerRelativeUrl + "/_api/web/currentuser",
type: "GET",
async:false,
headers: { "Accept": "application/json;odata=verbose" }
}).success(function( data ){
console.log( data );
console.log( data.d.Title );
}).error(function(e){
console.log( e );
});
}getCurrentLogInUser();
</script>
}getCurrentLogInUser();
</script>
Output:
Raju Kumar. Yadav
Comments
Post a Comment