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 Fitzsimons
http://www.nickfitz.co.uk/

Reply via email to