Johan's Blog

This and that in a developer's life in general
Welcome to Blogs @ IRM Sign in | Join | Help
 Search

Disclaimer

The content of this site is my own personal opinion and does not in any way represent my employer, it's subsideries or affiliates. These postings are provided "AS IS" with no warranties, and confer no rights.

This Blog

Json, jQuery and ASP.NET MVC

aspnetI’m stacking a few things here related to Json, jQuery and ASP.NET MVC so that I can get to them later on.

JQuery to grab some Json when a web page is loaded:

$(document).ready(function() {
    $.getJSON("/MyController/MyJsonAction", null, function(data) {
//do stuff with data here
}); });

The smallish code in the ASP.NET MVC controller:

public JsonResult GetJson()

{

    return Json(GetList());

}

It’s possible to use anonymous types with Json() as well, which is very useful but may be harder to unit test.


Cross-posted from my blog at http://weblogs.asp.net/jdanforth
Published den 3 april 2009 14:01 by johan
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server, by Telligent Systems