I have tried with following code but shows null in the controller side..
view:
<script>
function getme(){
debugger;
var emp = [
{ empid: 1, name: 'sasi' },
{ empid: 2, name: 'sathish'}
];
emp = JSON.stringify({ 'emp': emp });
$.ajax({
contentType: 'application/json; charset=utf-8',
dataType: 'json',
type: 'POST',
url: '/Home/getemplist',
data: JSON.stringify(emp)
});
}
</script>
<input type="button" onclick="getme();" value="Click me" />
controller:
public void getemplist(List<Emp> emp)
{ }
Emp.cs:
public class Emp
{
public int empid { get; set; }
public string name{get;set;}
}