Ok I know the answer to this is easy I just have very very little experience in Javascript. Inside ctx.ExecuteQuery the alert pops up the value I want. How do i get it down below to the userName.Split('|'); Total newbie here so please do not make fun of me to bad for not knowing what I am doing..
Edit: Can i return a var from the Async Function this is my Source https://msdn.microsoft.com/en-us/library/office/ee535262(v=office.14).aspx?cs-save-lang=1&cs-lang=javascript#code-snippet-2 I would like to return or if there is a better way
var user = ctx.get_web().get_currentUser();
ctx.load(user);
var userName;
ctx.executeQueryAsync(function(){
userName = user.get_loginName();
alert(userName);
}, function(){alert(":(");});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var userSplit = userName.split('|');