I always get undefined on my SP.ClientContext.get_current()
I have tried with this code:
SP.SOD.executeFunc('sp.js','SP.ClientContext',runthiscode);
function runthiscode(){
SP.SOD.executeFunc('SP.UserProfiles.js','SP.UserProfiles',initialize);
}
And this code:
ExecuteOrDelayUntilScriptLoaded(initialize, "SP.UserProfiles.js");
I use this code for all scripts
<script type="text/javascript">
if (window.jQuery == undefined)
document.write(unescape('%3Cscript src="../style library/scripts/jquery-2.0.3.js" type="text/javascript"%3E%3C/script%3E') );
document.write(unescape('%3Cscript src="/_layouts/15/SP.js" type="text/javascript"%3E%3C/script%3E') );
document.write(unescape('%3Cscript src="/_layouts/15/SP.UserProfiles.js" type="text/javascript"%3E%3C/script%3E') );
</script>
The script is working if the newform.aspx is in edit page, then it autofill my columns from mysite information.
Update!
I got SP.js working, but not for userprofiles.js this is the code that is working for now:
var ctx = new SP.ClientContext.get_current();
var peopleManager = new SP.UserProfiles.PeopleManager(ctx);
ctx.add_requestFailed(function (sender, args) {
alert('Request failed: ' + args.get_message());
});
function example () {
}
window.onload = example;
So what can the problem be with the userprofiles ?
Update,
With this code above i cant push the button save