Consuming ADO.NET Data Services from jQuery

Posted by Martyn at 3/10/2009 6:23:28 PM

Tags: jQuery | DataServices

One thing that has certainly sped up my development time is using ADO.NET Data Services with my AJAX.  Instead of having to build controller actions or a web service to grab the data, i can just consume it from the data service directly.

I'm going to assume you know how to set up a Data Service - it really isn't too hard.

Actually getting jQuery to consume it isn't much harder. All you need is the standard '$.getJSON' function, and you're flying.

One thing that tripped me up, however, was the data that was returned from the service: a quick glance shows that the data is wrapped in a 'd' object.

{ "d" : [ (data here) ] }

Lambda42 © Copyright 2010. All Rights Reserved.