Steps
- Create page in your sharepoint site.
- Edit the page and add a content editor webpart in sharepoint your page.
- Copy hte below scitp in notepad and save it as a .js file in your site asset.
- copy hte path of your notepad and paste it in a CEWP edit webpart link.
- save the page .
- out put will be displayed in alert box.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var thisUserAccount ;
$(document).ready(function() {
thisUserAccount= $().SPServices.SPGetCurrentUser({
fieldName: "Title",
debug: false
});
alert(thisUserAccount);
});
</script>Thanks for learning.