JScript .NETCloudVisual Studio 2008XAMLADO.NETWCFC# 3.0WPFIntermediateDevVisual StudioJavascriptWindowsASP.NETC#
Passing parameters to Success method in executeQueryAsync in SharePoint





5.00/5 (2 votes)
Passing Parameters to Success method in executeQueryAsync.
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);