I want to pass data from value and corresponding recordID to controller method for each cart item in my shopping cart.
My for loop generate input field for each cart item like this
@for (int i = 0; i < Model.CartItems.Count; i++)
{
}
This is my try hard script.I don't know how to get that data-id and value of input so i can pass both to controller method. I want to send pair of id and input value for each cart item in shopping cart so method can update quantity changes for every product in cart.
$(".UpdateQuantity").click(function(){
$("input[data-id][value]").each(function(i){
$.ajax({
type:"POST",
url:"/ShopingCart/UpdateCartQuantity",
data:{"id":input[data-id],"cartCount":input[value]},
dataType:'json',
cache:false,
contenttype:"application/jsonrequest; charset=utf-8"
}
)
})})
No comments:
Post a Comment