Introduction
This is quick tip about how to pass parameters and retrieve values from the
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);