I am trying to count the elements in my database using ajax/json in asp.net with a GET method. This is what I have so far:
// GET: /People/
public JsonResult Index()
{
var count = db.People.ToList().Count;
return Json(count);
}
Here is the JavaScript code:
function check_count() {
var how_many=$.ajax(
{
type:'GET',
url:'/People/',
success: function(data){
alert('successful');
}
});
}