title: How do I stop an Actionlink redirect and instead popup and redirect using javascript?
body: <p>This is script what I have currently -</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          $(document).ready(function () {
              $('.RemoveSystem').click(function () {
                  var href = $(this).attr('href');
                  var answer = confirm("Are you sure you want to delete this system?");
                  alert(answer);
                  if (answer) 
                      window.location = href;
              });
          });
      &lt;/script&gt; 
  </code></pre>
  
  <p>Here is the link which is there for each record and we can delete each system when we click on its delete button  -</p>
  
  <pre><code> &lt;%= Html.ActionLink("Delete", "RemoveSystem", new { SysNum = item.Id}, new { @class = "RemoveSystem" })%&gt;
  </code></pre>
  
  <p>Now here is the problem the actionlink redirects no matter what happens and I need to stop it. I mean say the user presses cancel on the confirm the actionlink still executes and goes to RemoveSystem Action, where I want it to just stay on the page.I thought of using a HTML hyperlink but I dont know how I should pass id the value to the javascript in that case. Can anyone please help me out ?</p>