Hi,

you can use the context option with Ajax.NET Professional like this:


<script type="text/javascript">

function mymethod(testvar) {
    ajax.getobject(callback, testvar);
}

function callback(res) {
    var obj = res.value;
    var testvar = res.context;
}

</script>


The testvar is not passed to the server, it is stored locally and you
can use it later. A second way you can do is following:

<script type="text/javascript">

var myclass = function() {}

Object.extend(myclass.prototype, {
    mymethod: function(testval) {
        this.testval = testval;
        ajax.getobject(this.callback.bind(this));
    },
    callback: function(res) {
        var obj = res.value;
        alert(this.testval);
    }
}, false);

var x = new myclass();
x.mymethod("test");

</script>


I prefer the second way if you want to add more logic and functions.
If you only want to have the original value there it is enough with
the first example.

Regards,
Michael



On 5/31/06, gary <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a parameters that I don't wish to pass back to server side code
> but do wish to use it when I get the callback. How would one go about
> doing this without using global scope?
>
> For example,
>
>
> function mymethod(testvar) {
>
> ajax.getobject(callback);
> }
>
>
> function callback(res) {
>
> var obj=res.value;
>
> // here I want to use the testvar that I passed into the 'mymethod'
> above.
>
> }
>
>
> >
>


-- 
Best regards | Schöne Grüße
Michael

Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---

Reply via email to