Click here to Skip to main content
12,819,095 members (27,989 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 5 Aug 2010

Using Passing Parameters -arguments- to OnSuccess Callback function in a Asp.Net Ajax

, 5 Aug 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
How to pass custom args to the OnSuccess callback function of javascript ajax

This code snippet solves the problem of passing parameters to the callback OnSuccess or onreadystatechange functions used in javascript Ajax with or without Microsoft .Net framework

On many forums people ask how to do that.


Useful also in Asp.Net Ajax development environments (using integrated Microsoft Ajax).

    //Function to call when OnSuccess or onreadystatechange
    function yourCallBack(arg1,arg2) {
        return function(result) { // Your old function
            alert(arg1);  // param will be accessible here
            alert(arg2);  // param will be accessible here
            alert(result);// result = the response returned from Ajax

Very simple and easy, try it .

Points of Interest

Usefull for some complex scenarios that requires passing variables to the ajax delegate.


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


About the Author

No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170308.1 | Last Updated 5 Aug 2010
Article Copyright 2010 by Alejandro Barrada
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid