javascript - Fancybox initiated element -
i have grid in displaying multiple deals. each deal has multiple sub deals. have display sub deals in fancybox popup of respective deal on click event. have store deal id in data attirbute of anchor element. stuck when sending ajax request cannot pass respective deal id since unable element clicked. here code:
$('.deal_parent').fancybox({ href : subdealurl, ajax : { type : "get", data : 'deal='+{here want pass deal id dynamically}, }, 'overlayopacity' : '0.2', 'transitionin' : 'elastic', 'transitionout' : 'fade', });
i have tried passing $(this).data('deal')
there doesnt worked.
try invoking fancybox differently, e.g.:
$('.deal_parent').click( function () { // can use $(this) $.fancybox({ href : subdealurl, ajax : { type : "get", data : 'deal='+$(this).data('deal'), }, 'overlayopacity' : '0.2', 'transitionin' : 'elastic', 'transitionout' : 'fade', }); });
i haven't tested it, code may need adjustments.
Comments
Post a Comment