Member
24 Points
316 Posts
Sep 28, 2019 12:41 PM|Aliyilmaz|LINK
Hi Lewis,
I changed the code a little. Because when you press the button, projects will come according to that category id. I do not come id that way.
Also how to get projects by category. Isn't jquery right?
Index.cshtml
<div id="Projeler" class="filter-items"> <div class="row"> @foreach (var item in ViewBag.Proje) { <div id="catid" class="mix col-lg-4 col-md-4 col-sm-12 col-12 @item.CatId"> <div class="box-item"> <a id="catresim" class="resim" href="~/resimler/@item.ResimYolu" asp-append-version="true" data-rel="lightcase"> <img class="img-fluid resim" src="~/resimler/@item.ResimYolu" alt="item1" /> </a> <a class="resim" href="~/resimler/@item.ResimYolu" data-rel="lightcase"> <h3 id="catitem" class="item-name mb-0">@item.Baslik</h3> </a> <span id="catname" class="cat-name">@item.İcerik</span> </div> </div> } </div> </div>
Jquery,
<script type="text/javascript"> $(document).ready(function () { $(".but").click(function () { function GetProje(id) { $.ajax({ type: 'GET', url: '/Home/GetProje/', data: { id: id }, contentType: "application/json; charset=utf-8", dataType: 'json', success: function (data) { $.each(data, function (i, item) { $("#catid").append(item.catId); $("#catresim").append(item.resimYolu); $(".resim").append(item.resimYolu); $("#catitem").append(item.baslik); $("#catname").append(item.İcerik); }); }, error: function (response) { alert(response.responseText); } }); }; }); }); </script>
Member
24 Points
316 Posts
Re: Asp.Net Core Category - Product
Sep 28, 2019 12:41 PM|Aliyilmaz|LINK
Hi Lewis,
I changed the code a little. Because when you press the button, projects will come according to that category id. I do not come id that way.
Also how to get projects by category. Isn't jquery right?
Index.cshtml
Jquery,
https://www.portakalahsap.com
https://www.portakalahsap.com/ofis-mobilyalari