I'm trying to parse data from a page of JSON in my ASP.NET MVC 1.0 web application. I need this data to display in a table on page load and I'm having a great deal of trouble mainly because I've never used JSON before. The JQuery site gives pretty terrible examples as well. This is what I have so far, I need help writing a function:
$("document").ready(function() {
$.getJSON("http://localhost:1909/encoders",
function(data) {
$.each(data.items, function() {
});
});
});
The URL above is currently just displaying JSON and the two columns I am getting from the SQL server to produce the JSON are EncoderName and EncoderStatus. The id is displayencoders.
Thanks!
edit: my controller looks like this:
[UrlRoute(Name = "GetEncoders", Path = "encoders")]
public ActionResult GetEncoders() {
var encoders = Database.GetEncoders();
return Json(encoders);
}
when compiled my /encoders/ looks like:
{
* EncoderName: "rmcp2-encoder"
* EncoderStatus: "inactive"
}