How to consume OData service with Html/Javascript?

AlvinfromDiaspar picture AlvinfromDiaspar · Apr 11, 2012 · Viewed 35.4k times · Source

Our project currently uses Silverlight to consume an Odata service. This has made life pretty simple since we can just reference the OData service thus giving us generated service reference/entities.

However there is some discussion on whether we should move to Html (html5). I'd like to know what to expect if we make this change. We'd be leveraging a framework like jQuery of course.

  • My main concern is how to consume the same OData service via JavaScript/jQuery.
  • How are we suppose to deserialize/serialize entities returned from this OData service?
  • Is our data contract supposed to be hard-coded (if so, this is really unacceptable for us)?

Thanks!

Answer

Rich Turner picture Rich Turner · Apr 11, 2012

OData sources can return data as JSON so your web pages can XHR your data and receive it as JSON which gets de-serialized back into a Javascript object for you to pick apart and act-upon or display.

Here are some additional links to get you started:

HTH.