I'm getting the error Object doesn't support property or method 'ExecuteOrDelayUntilScriptLoaded'.
Below is my code.
SP.SOD.ExecuteOrDelayUntilScriptLoaded(getCurrentUser, "sp.js");
function getCurrentUser() {
var context = new SP.ClientContext.get_current();
var web = context.get_web();
currentUser = web.get_currentUser();
context.load(currentUser);
context.executeQueryAsync(onSuccess, onFail);
}
function onSuccess(sender, args) {
var acountname = currentUser.get_loginName(); // extract the login name from the account name
alert(acountname);
}
function onFail(sender, args) {
alert('Failed to get current user' + args.get_message());
}