I find few answers on this theme, but none of them helped me.
My on click fires on second click - where is the problem?
<script type="text/javascript">
$(function () {
$("#back-in-stock-subscribe").click(function () {
var sku = document.getElementById('back-in-stock-sku-to-get').textContent;
var action = '@Url.RouteUrl("BackInStockSubscribePopup", new { productSku = "sku" })';
action = action.replace("sku", sku);
$("#back-in-stock-subscribe").fancybox({
'href': action,
'transitionIn': 'none',
'width': 500,
'height': 200,
'type': 'iframe',
'centerOnScroll': true
});
});
});
</script>