I am new to Javascript, hope my question is not too obvious.
I have a button in my view: (ASP.NET MVC 4)
<input name="button" type="button" id="button1" value="Click me1"/>
I add a click Handler :
<script>
(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)
</script>
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:
http://localhost:64321/Placeholder/Placeholder/Index
Why the repetition? What am I doing wrong?
(I have to use Javascript )
(Not the real code, but simplified as much as possible to show the issue)
Thanks in advance
Philippe
Placeholder/fromPlaceholder/Index?http://localhost:64321/Index/Index/Index/....