I have a little jquery code:
//foreach the inputs
json.push({
Var1: $(this).attr("id"),
Var2: filename,
Var3: hash_name
});
//end foreach
$.post(url, {test: json}, function(){}, 'json');
We suppose that json has 3 objects (after browsing 3 inputs and getting their values). and the structure in MVC3 model:
public struct Simple
{
public string Var1 {
get;
set;
}
public string Var2{
get;
set;
}
public string Var3{
get;
set;
}
public bool Var4 {
get;
set;
}
}
and the controller:
[HttpPost]
public ActionResult Test( List<Simple> test) {
...
}
the List<Simple> returns 3 elements (here is correct) but the values for all properties are null (except Var4 which is false).
Why ?