Pass a jquery variable to @Url.Action MVC3

asp.net-mvc, asp.net-mvc-3, jquery-ui

Solution

I think this will work for you. I find it a bit more cleaner and is an alternative option.

window.location = "/batch/printtopdf?allocationId=" + unSelected;

It stands for

window.location = "/yourControllerName/yourActionMethodName?QueryStringId=" + yourVariable;

Problem

How can I pass my client side variable to controller using Url.Action. I am trying to do like this, but it's not working ``` location.href = '@Url.Action("printtopdf","batch",new {allocationId=unSelected}))'; ``` In the above line 'unSelected' is a client side variable and comma separated values.

Original source