Click here to Skip to main content
Click here to Skip to main content
Go to top

Passing parameters to Success method in executeQueryAsync in SharePoint

, 21 Aug 2013
Rate this:
Please Sign up or sign in to vote.
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);

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

shahed.sohail
Technical Lead Softedge Systems LTD
Ireland Ireland
 Experienced software professional with 7 years+ on Microsoft Technology.
 Knowledge of SDLC (System Development Life Cycle).
 Technical Team Member experience leading application development on both short and long term projects.
 Good team player with excellent work history as regards with work ethics, dependability and willingness to go an extra mile.
 Good knowledge of IIS Hosting and Domain management.
 Extensive knowledge of ASP.Net, C#.Net, VB.Net, SQL Server, SharePoint development using SharePoint Web Services and SharePoint administration, Business Intelligence & KPIs (Configuration and Creation) Web Parts, Data View Webparts, Integration of External Sources content types, Site Definition, Site templates, Workflow development, customizing and branding a SharePoint portal sites and branding.
Follow on   Google+

Comments and Discussions

 
QuestionPassing Parameters to Success method in executeQueryAsync SharePoint - Original PinmemberIsha Attlee28-Aug-13 15:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 21 Aug 2013
Article Copyright 2013 by shahed.sohail
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid