title: Url action parameters using Ajax
body: <p>I am trying to pass data from a view to a controller using parameters. 
  Now I am running a few difficulities. I am trying to pass those parameters once I select a row from a table and press on a button which has a onclick method to ShowTasks()</p>
  
  <p>The C# controller: </p>
  
  <pre><code>     [Route("/service/delivery/{id}/{shopdoccode}/{regdate}")]
       public ActionResult Delivery(string id, string shopdoccode, string regdate)
       {
          //do stuf
       }
  </code></pre>
  
  <p>The Javascript function when user clicks on button:</p>
  
  <pre><code>function ShowTasks() {
      //Dear Stackoverflow &gt; This works, this is for selecting a row in the table
      var $selectedRow = $(".highlight");
      if ($selectedRow.length == 1) {
          var dcColumn = 0;
          var rdColumn = 1;
          var shopdoccodeColumn = 3;
  
          //assigning name to the colomn value 
          var id = $selectedRow[0].children[dcColumn].innerText.trim();
          var regdate = $selectedRow[0].children[rdColumn].innerText.trim();
          var shopdoccode = $selectedRow[0].children[shopdoccodeColumn].innerText.trim();
  
          //ajax 
          if (id &amp;&amp; regdate &amp;&amp; shopdoccode) {
              $.ajax({
                  type: 'POST',
                  url: '@Url.Action("service", "delivery" ,new { id = "id", shopdoccode = "shopdoccode", regdate = "regdate" })',
                  data: { id, regdate, shopdoccode },
                  success: function (data) {
                      if (data.success) {
                          console.log("Succes");
                      }
  
                  },
                  error: function (data) {
                      console.log("Error");
                  }
              });
          }
      }
  }
  </code></pre>
  
  <p>What have I done so far? Sitting for hours trying to find a way to give the parameters to my controller so I can invoke a SQL stored procedure. 
  Unforntunately I can not simply use a hidden form for this.</p>
  
  <p>Also this was quite helpful:
  <a href="https://stackoverflow.com/questions/6278694/url-action-parameters">Url.Action parameters?</a></p>
  
  <p>@sleeyuen
  <a href="https://i.stack.imgur.com/Nq2S1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nq2S1.png" alt="enter image description here"></a></p>