I am trying to pass a variabel from a .click event to a colorbox plugin like so:
$('.w_price_assess p.price_report > a').live('click', function() {
var $reportRef = $(this).attr('href');
var $reportID = $reportRef.substr($reportRef.lastIndexOf('/') + 1);
return false;
});
I need $reportID to be visible to an AJAX call to form part of a URL.
Can this be done? My knowledge of doing this is limited obviously 🙁
How about declaring the variable outside of click event and giving it public visibility:
Now you can use
$reportIDelsewhere in your script too.