I am using variable from another method (AppPath) and trying to assign its value to title field. But this is not working. I am doing some basic mistake may be not declaring global variable( I have tried that also using google, if this is the case please provide me exact step to declare and where to declare). can someone please help. Below is my code
\
function createList()
{
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('coolnew');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
alert('1');
oListItem.set_item('Title', AppPath);
alert('2');
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
var result = oList.get_title() + ' created.';
alert(result);
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());
}
\