I am trying to push a div id into an array.Array push is working good bofore ajax call.But when i use push inside ajax success first push is taken place when i click on the second element.that is
array operation when with below code( array push inside success)
first click on id="1"  --- resuting array []
second click on id="2"  --- resulting array [1]
second click on id="3"  --- resulting array [1,2]
my code
$(document).ready(function() {
    var count = 0;
    var vPool = '';
    arr = [];
    seat = [];
    var totalseat = '<?php echo $sumofseat; ?>';
    var date = ' <?php echo $new_date; ?>';
    $('.custom_checkbox').click(function() {
        pressed = true;
        var prev = $(this).attr('class');
        var arrid = $(this).attr('id');
        var seats = $(this).attr('title');
        count = $('.selected').length;
        if (prev == 'custom_checkbox') {
            //arr.push(arrid);
            //seat.push(seats);
            $.ajax({
                url: "seat_manipulation.php",
                dataType: 'json',
                data: '&operation=save&seat=' + arrid + '&guid=<?php echo $guid; ?>&date=' + date,
                type: "POST",
                context: this,
                success: function(data) {
                    if (data.status == 'SAVED') {
                        $(this).toggleClass('selected');
                        $('#count').slideDown();
                        $('#selecte_seat').show();
                        $('#count').html(count + ' Seats selected');
                        alert(arrid);
                        //if(jQuery.inArray(arrid,arr) == -1) {
                        arr.push(arrid);
                        //}
                        //if(jQuery.inArray(seats,seat) == -1) {
                        seat.push(seats);
                        //}
                    } else {
                        alert("Seat already been used.Please select another");
                    }
                }
            })
        }
    });
});
am i wrong..or this is how its suposed to work ?? Thanks in advance