Timeline for Get current logged in user and display it on the Site as "Hello (Username)"
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 18, 2015 at 13:58 | vote | accept | 011011010101110100001010010 | ||
| Jun 18, 2015 at 11:09 | comment | added | eirikb | Note: Guessing you use jQuery in your example (based on $.ajax). You can use CurrentUser as end point. You can use $.getJSON because OP is on SharePoint Online (no need for odata type). You can use jQuery to select and set value on element. E.g., $.getJSON("/_api/Web/CurrentUser").done(function(user) { $('#id').text(user.data.d.Title); }); | |
| Jun 18, 2015 at 10:53 | history | edited | Patrick | CC BY-SA 3.0 | improved codesample |
| Jun 18, 2015 at 10:52 | comment | added | Patrick | I'm doing exactly the same to "Welcome the logged in user". Therefore you only have to set a id for your div where it should be shown and then put the id (e.g. id="welcome") into the code. document.getElementById("welcome").innerHTML = "Hello " + loginName; Also updated the script. | |
| Jun 18, 2015 at 10:45 | comment | added | 011011010101110100001010010 | Hi Patrick thanks for this however i'm trying to add this to the page, not as a alert, but more to display as Text | |
| Jun 18, 2015 at 10:30 | history | edited | Patrick | CC BY-SA 3.0 | improved content |
| Jun 18, 2015 at 10:18 | history | edited | Patrick | CC BY-SA 3.0 | edited body |
| Jun 18, 2015 at 10:13 | history | answered | Patrick | CC BY-SA 3.0 |