I have this controller action that is called from and script, works fine in visualstudio adds the item ok, but when add to iis server as an app with a virtual dir looks like "Store/ShoppingCart/AddToCart" and should only be "/ShoppingCart/AddToCart" is there a way to remove the app dir name "Store"? thanks in advance
public ActionResult AddToCart(int id, int qty)
{
var addedItem = storeDB.Items
.Single(item => item.ID == id);
var cart = ShoppingCart.GetCart(this.HttpContext);
int count = 0;
int ct = 0;
while (ct < qty)
{
count = cart.AddToCart(addedItem);
ct++;
}
* script
$(function () {
$('.AddLink').click(function () {
var quantity = $(this).closest('.product').find('.qty-input').val();
var recordToAdd = $(this).data('id'); // correct usage to access data- attributes
var url = '@Url.("AddToCart", "ShoppingCart")';
if (recordToAdd != '') { // not sure why you need this (why would it ever be null?)
$.post( url, { "id": recordToAdd, "qty": quantity }, function (data) {
$('#cart-status').text(data.CartCount);
});
}
});
});