I am confused why this code is not working:
HTML:
<li><a id="faktura-generate" rel="regular">Faktúra</a></li>
<li><a id="proforma-generate" rel="proforma">Zálohová faktúra</a></li>
JS:
$('#faktura-generate, #proforma-generate').live('click', function () {
var type = $(this).attr('rel');
$.ajax({
url: 'index.php?route=sale/order/superfaktura&token=<?php echo $token; ?>&order_id=<?php echo $order_id; ?>&type=' + type,
dataType: 'json',
beforeSend: function () {
$(this).after('<img src="view/image/loading.gif" class="loading" style="padding-left: 5px;" />');
}
});
});
I want to show a little loading icon after user clicks one of the link. $("#proforma-faktura").after(...)
is working, but $(this).after(...)
not.