I tried the below code from MSDN
function retrieveListItems() {
var clientContext = new SP.ClientContext('http://www.vignesh.cloudappsportal.com');
var oList = clientContext.get_web().get_lists().getByTitle('EmailId');
clientContext.load(oList);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
function onQuerySucceeded(sender, args) {
SPListItems.push(sender); // pushing values into a global array to check in console
SPListItems.push(args);
}
function onQueryFailed(sender, args) {
alert('fail')
}
}
oList is getting some values, but i get error in this.onQuerySucceeded
this is referring to window and so there is no function like this.onQuerySucceeded