I am using ASP.NET MVC 3 for the first time. I want to call a controller action with a single parameter. this parameter is an object, not a simple type. Let’s say:
Controller = “Person”,
Action=”Add”,
The single argument of this action is an object: “Person” = {Name: “aaa”, Age: 24}
I implement the ModelBinder neaded for such a parameter (Person). I am calling this action from the client with the following instruction:
var person= {};
person.Name = "aaa"; person.Age = 24;
var **url = '/Person/Add/' + $.param(person)**;
**window.location = url;**
This is my first program in Asp.NET MVC. I thing this is the right way to write the ‘url’.
Could you please help me to create the variable ‘url’ (needed to call the server action) in the right format ?
Thinks
You can pass that in the querystring like this
Assumuing you have
HttpGETAction method which is looks like eitheror
assuming Name and Age are 2 properties of
Personclass