title: ASP.NET MVC - Failed to navigate in a javascript handler
body: <p>I am new to Javascript, hope my question is not too obvious. </p>
  
  <p>I have a button in my view: (ASP.NET MVC 4)</p>
  
  <pre><code>&lt;input name="button" type="button" id="button1" value="Click me1"/&gt;
  </code></pre>
  
  <p>I add a click Handler :  </p>
  
  <pre><code>&lt;script&gt;
  (function ($) {
      map = new Object();
      map['T1'] = 'Placeholder/Index';
  ... // Truncated 
      map['T11'] = 'Placeholder/Index';
  
      $('#button1').click(function ()
      {
          // alert('button1 clicked');
          window.location.href = map['T1'];
      });
  })(jQuery)
  &lt;/script&gt;  
  </code></pre>
  
  <p>The code works fine the first time I click the button. But, the next times I get an error.
  I can see in the address bar the following URL:  </p>
  
  <pre><code>http://localhost:64321/Placeholder/Placeholder/Index
  </code></pre>
  
  <p>Why the repetition? What am I doing wrong?<br>
  (I have to use Javascript )  </p>
  
  <p><em>(Not the real code, but simplified as much as possible to show the issue)</em>  </p>
  
  <p>Thanks in advance<br>
  <strong>Philippe</strong></p>