Código PHP:
<table cellspacing="0" class="shop_table cart">
<tbody>
@foreach ($products as $product)
<tr data-id="{{ $product->id }}" class="cart_table_item">
<td class="product-remove">
<a title="Eliminar este producto" class="remove" href="#">
<i class="fa fa-times"></i>
</a>
</td>
<td class="product-thumbnail">
<img width="100" height="100" alt="" class="img-responsive" src="{{ asset('img/products/product-1.jpg') }}">
</td>
<td class="product-name">
{{ $product->name }}
</td>
<td class="product-price">
<span class="amount">{{ $product->price }}</span>
</td>
<td class="product-quantity">
{{ $product->qty }}
</td>
<td class="product-subtotal">
<span class="amount">{{ $product->price * $product->qty }}</span>
</td>
</tr>
@endforeach
</tbody>
</table>
Código HTML:
$(document).ready(function() { $('a.remove').click(function() { var row = $(this).parents("tr"); var id = row.data("id"); alert(id); }); });