Summary assing Parameters to Success method in executeQueryAsync SharePoint, Passing Parameters and Returning Values from Success method in executeQueryAsync + Client Object Model + SharePoint 2010\SharePoint 2013,How to Pass Parameters and Retrieve Values from Success method in executeQueryAsync() SharePoint
This is quick tip about how to Pass Parameters and Retrieve Values from Success method in executeQueryAsync()
To Pass a Parameter in Success method use the following Syntax –
Before passing Parameters:
context.executeQueryAsync(Function.createDelegate(this,this.success)),
Function.createDelegate(this, this.failed));
After passing Parameters:
context.executeQueryAsync(
Function.createDelegate(this,function(){success(_parameter);}),
Function.createDelegate(this, this.failed));
function success(_parameter)
{
alert("In Success Method! " + _parameter);
}
To Retrieve Values from Success method use the following Syntax –
context.executeQueryAsync(
Function.createDelegate(this, function(){ _returnParam = success(_parameter);}),
Function.createDelegate (this, this.failed));
alert(_returnParam);