This project is read-only.

Adding quantity input to pass to Shopping Cart

Jan 24, 2012 at 6:00 AM

Hi, following the MVCMusicStore 2.0 tutorial by Jon,

I want to add a textbox "Add Quantity" on the Details page so that a user can input the number of quantity for the album to add to shopping cart

I have added the Ajax Request in "Shopping Cart/Index.cshtml"


    <em>Enter Quantity</em>
    <input type="text" value="1" class="Quantity" id="Quantity" /> 

<p class="button">
@Html.ActionLink("Add to cart", "AddToCart", "ShoppingCart", new { id = Model.ProductId }, "")

Views\Shopping Cart\Index.cshtml

$('#AddToCartLink').click(function () {
            var link = $(this).attr('href') + '?quantity=' + $(this).siblings('.Quantity').val();

                url: link,
                type: "POST",
                success: AddToCartSuccess,
                error: AddToCartFailure

Right now when i click add to cart i get a; 

A potentially dangerous Request.Path value was detected from the client (<).

I understand thats because i'm not passing any data. 

What do i do to pass the data?

How do i get this done?

Thank you in advance..