
- 1
Hi,
We are trying to achieve the similiar behaviour like below which is in Emporium demo.But getting Ajax cat failure error.

Here is the code from ProdctBox.cshtml
Here is the error screenshot from console

We are trying to achieve the similiar behaviour like below which is in Emporium demo.But getting Ajax cat failure error.
Here is the code from ProdctBox.cshtml
<div class="buttons">
@if (!Model.ProductPrice.DisableBuyButton)
{
var addToCartText = T("ShoppingCart.AddToCart").Text;
if (Model.ProductPrice.IsRental)
{
addToCartText = T("ShoppingCart.Rent").Text;
}
if (Model.ProductPrice.AvailableForPreOrder)
{
addToCartText = T("ShoppingCart.PreOrder").Text;
}
<div class="add-to-cart-qty-wrapper">
<input asp-for="EnteredQuantity" id="product_enteredQuantity_@Model.Id" value="1" class="qty-input" type="text" aria-label=@T("Products.Qty.AriaLabel") />
<span class="plus">i</span>
<span class="minus">h</span>
</div>
<script asp-location="Footer">
//when a customer clicks 'Enter' button we submit the "add to cart" button (if visible)
$(document).ready(function () {
$("#@Html.IdFor(model => model.EnteredQuantity)").on("keydown", function (event) {
if (event.keyCode == 13) {
$("#add-to-cart-button-@Model.Id").trigger("click");
return false;
}
});
$("#product_enteredQuantity_@Model.Id").on("input propertychange paste", function () {
var data = {
productId: @Model.Id,
quantity: $('#product_enteredQuantity_@Model.Id').val()
};
$(document).trigger({ type: "product_quantity_changed", changedData: data });
});
});
</script>
<button type="button" id="add-to-cart-button-@Model.Id" class="button-1 add-to-cart-button" data-productid="@Model.Id" onclick="AjaxCart.addproducttocart_details('@Url.RouteUrl("AddProductToCart-Details", new {productId = Model.Id, shoppingCartTypeId = (int) ShoppingCartType.ShoppingCart})', '#product-details-form');return false;">@addToCartText</button>
}
</div>
Here is the error screenshot from console