title: Getting input value to action method. Mvc Core & AJAX
body: <p>I'm new to MVC Core and i'm having some struggles getting this right.</p>
  
  <p>I've got a table filled with some basic values from my products, and what i want is to send a quantity value and an id of the product to my action method. The problem i'm having is that i'm able to send my product.ID to the action method, but i can't seem to get my input value. I tried using a button instead of my  element and when i used that i managed to get the input but not the product.ID.</p>
  
  <pre><code>@model List&lt;Product&gt;
  
  &lt;div id="productList"&gt;
      &lt;form&gt;
          &lt;table&gt;
              @foreach (var product in Model)
              {
                  &lt;tr&gt;
                      &lt;td&gt;@product.Name&lt;/td&gt;
                      &lt;td&gt;@product.Price&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="quantity" /&gt;&lt;/td&gt;
                      &lt;td&gt;
                          &lt;a
                             asp-action="AddProductToCart"
                             asp-route-id="@product.ID"
                             data-ajax="true"
                             data-ajax-method="GET"
                             data-ajax-mode="replace"
                             data-ajax-update="#cartinfo"&gt;Add to basket&lt;/a&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              }
          &lt;/table&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  
  &lt;div id="cartinfo"&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>My action methods parameters looks like this:</p>
  
  <pre><code>public IActionResult AddProductToCart(int id, int quantity)
  </code></pre>
  
  <p>I'm sure i'm missing some basic knowledge about how forms work so i'd really appreciate getting some help here. I've been trying to google this but i'm struggling with that as well. Thanks a lot</p>