Cannot pass parameter to ajax post

Hi folks,

I’m trying to pass a parameter to my ajax page, but not having much luck.

    

// here is my fancybox script which the eventid shows fine.

    var fancyContent = ('<div class="header">approve booking for event id'  + eventid + '<a href="#" class="approve" id="' + eventid + '">yes</a><a href="#" class="approve">no</a></div>');
    $.fancybox({
        content: fancyContent
            });    

// get event id from link clicked

var getid = $('.approve').attr('id');

// my alert here displays the id fine

alert(getid);

// I then begin my click function passing the getid as a parameter

$('.approve').click(function(calEvent, jsEvent, view, getid){

// my alert here is ALWAYS undefined, any ideas?

alert(getid);






Any help much appreciated, I just cannot seemto pass the ID.

What do you get if it’s


$('.approve').click(function() {
  var getid = $(this).attr('id');
  alert(getid);
});

?

Just to check that yeah, it can be grabbed?
If your click function is within a function describing the other variables, the click function would have access to them. Then inside the .click function you could have a .post with all the others.

Many thanks! Its working now