When I try to run my javascript SP.JS file in a user control I get this error: Microsoft JScript runtime error: Unable to get value of the property 'isNullOrUndefined': object is null or undefined
The complete code is the following (Just copied it over from a book).
<script type="text/javascript" src="/_layouts/MicrosoftAjax.js" ></script>
<script type="text/javascript" src="/_layouts/SP.js" ></script>
<script language="javascript" type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(GetTitle, "sp.js");
var site;
var context;
function GetTitle() {
context = SP.ClientContext.get_current();
site = context.get_web();
context.load(site);
context.executeQueryAsync(onQuerySucceeded, onQueryFailed);
}
function onQueryFailed(sender, args) {
alert('request failed ' + args.get_message() + '\n' + args.get_stackTrace());
}
function onQuerySucceeded(sender, args) {
document.getElementById("Text1").value = site.get_title();
}
function Button1_onclick() {
site.set_title(document.getElementById("Text1").value);
site.update();
context.load(site);
context.executeQueryAsync(onTitleUpdate, onQueryFailed);
}
function onTitleUpdate(sender, args) {
}
The function where the error occurs is...
SP.ClientContext.initializeBase(this,[SP.ScriptUtility.isNullOrUndefined(a)?SP.PageContextInfo.get_webServerRelativeUrl():a])};