Thanks for your reply.

Does this not gives problems when I have an AJAX request with a
timeout after say 2 seconds, but in the meantime there's another
request using the same variable? Or is the sentData only accessible in
the click( function(){ ....} ) scope?

There is no other way of getting the data I sent with the request?

On 17 sep, 15:28, Nick Fitzsimons <n...@nickfitz.co.uk> wrote:
> 2009/9/17 Flamer <mkapp...@gmail.com>:
>
>
>
>
>
> > Hello,
>
> > Is it possible to access the data arguments that are sent with the
> > ajax function?
>
> > Example:
> > $('#mycheckbox').click( function() {
> >        $.get( '/ajax.php', { nr: this.id }, function( data, textStatus ) {
> >                // Here I want to access the arguments I just sent with 
> > ajax.php
>
> >                // As example, something like this:
> >                $('#'+arguments.nr).attr('checked', 'checked');
> >        } );
>
> >        return false;
> > } );
>
> If I understand you correctly, then assigning your data object to a
> variable which can be accessed via a closure in the callback function
> would do it - something like:
>
> $('#mycheckbox').click( function() {
>        var sentData = { nr: this.id };
>        $.get( '/ajax.php', sentData, function( data, textStatus ) {
>                // Here I want to access the arguments I just sent with 
> ajax.php
>
>                // As example, something like this:
>                $('#'+ sentData.nr).attr('checked', 'checked');
>        } );
>
>        return false;
>
> } );
>
> should be all you need.
>
> Regards,
>
> Nick.
> --
> Nick Fitzsimonshttp://www.nickfitz.co.uk/

Reply via email to