how to get javascript variable into URL.Action mvc method

url.action

Solution

var dummyURL ='@Url.Action("EditEncounter", "EditEncounter", new { encounterId = -2, popId = TempData["POPULATIONID"] })';
                            var path =dummyURL.replace("-2", id);
                            debugger;
                            document.location.href = path;

That appears to work.

Problem

``` onSelectRow: function(id) { document.location.href = '@Url.Action("EditEncounter", "EditEncounter", new { encounterId = "'<%:id%>'", popId = TempData["POPULATIONID"] })' //new { encounterId = temp.EncounterId, popId = (int)TempData["POPULATIONID"] } } ``` How in sam hill do I get that id variable into my Url.Action method? This is what I am looking at when I debugg ``` document.location.href = '/EditEncounter/EditEncounter?encounterId=%40id&amp;popId=2' ```

Original source