in my page i have an int variable name mySerial and i want to pass a value from a script
mySerial =ui.item.Serial is not working
You could pass this variable as query string parameter to some controller action:
and the Foo action:
[HttpPost]
public ActionResult Foo(string mySerial)
{
... do something with the serial here
}
Another possibility is to perform a redirect if you don't want to use AJAX:
Or maybe I misunderstood your question and you want to assign your javascript variable to some value coming from the view model? In this case: