I am trying to load a JSON data into a Jquery DataTable in MVC 4.The following is the ActionResult in the Controller.
public ActionResult TimeZone()
{
BitlyDataStore json = new BitlyDataStore();
var result = json.GetTimeZoneWiseScoreCard();
return Json(result, JsonRequestBehavior.AllowGet);
}
The corresponding output is a JSON data.The data is:
{"Scores":[{"Subject":"America/Los_Angeles","Count":421},
{"Subject":"","Count":636},{"Subject":"America/Phoenix","Count":40},
{"Subject":"America/Chicago","Count":686},
{"Subject":"America/Indianapolis","Count":50},
{"Subject":"Australia/NSW","Count":32},
{"Subject":"America/New_York","Count":903},
{"Subject":"America/Denver","Count":89},
{"Subject":"America/Port_of_Spain","Count":1},{"Subject":null,"Count":120}]}
How do we load this into a JQueryTable in its corresponding view?I have read through the documentation but couldn't understand how to pass it.I have tried passing through the Ajax code in documentation.The code is:
$('#example').dataTable({
"ajax": {
"url": "/Bitly/TimeZone/",
"dataType": "json"
}
Scoresproperty is showing to have an array but I can't see a closing bracket for same!