Playing with SharePoint ECMAScript object model and browser's javascript console

Trying to debug SharePoint ECMAScript from Chrome or IE javascript console but you're just getting null objects and errors ?

In Chrome getting this message?
Error: The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

In Internet Explorer getting this:
The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

Try this code as starting point:
var ctx = SP.ClientContext.get_current();
var web = ctx.get_web();
ctx.load(web);
ctx.executeQueryAsync();
alert(web.get_title());
Have a nice day ;)

Comments