Click here to Skip to main content
11,492,523 members (59,091 online)
Click here to Skip to main content

Passing parameters to Success method in executeQueryAsync in SharePoint

, 21 Aug 2013 CPOL 12.5K 2
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 Pin
Isha Attlee28-Aug-13 16:14
memberIsha Attlee28-Aug-13 16: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 | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 21 Aug 2013
Article Copyright 2013 by shahed.sohail
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid