1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| <script type="text/javascript">
$(function() {
$('.Sendparams').click(function (e) {
e.preventDefault();
debugger;
// var id = $(this).attr('id');
var quant = $("#quant").val();
var id = $("#id").val();
$.ajax({
type: 'GET',
url: '/ShoppingCart/AddToCart',
data:{ "id": id , "quant": quant },
success: function (response) {
$("#mainContainerCenter").html(response); } });});
});
</script>
<section class="content">
<!-- Small boxes (Stat box) -->
<div class="row">
@foreach (var album in Model.Produits)
{
<div class="col-lg-3 col-xs-6">
@Html.Hidden("id", album.ProduitId, new { @id = "id" })<br/>
@album.Nom_Produit<br />
@album.Categorie.Nom_categorie<br />
@String.Format("{0:F}", album.Prix)<br />
@Html.TextBox("quant", null, new { id = "quant" })<br />
@Html.ActionLink("voila", "AddToCart", "ShoppingCart", new { id = album.ProduitId }, new { @class = "Sendparams" })<br />
</div>
}
</div>
</section> |
Partager