Nick Kahn
Nick Kahn

Reputation: 20078

Serialization in WCF using JQuery

is it possible to use WCF classes with attributes (like [DataMember....) then you wouldnt need to do seralization on the client side (jquery) ?

Upvotes: 1

Views: 103

Answers (1)

casperOne
casperOne

Reputation: 74530

The requirement to use jQuery on the client side when using WCF isn't a real requirement.

When using WCF, you have the option of determining the format on the wire. One of the formats when working with the web bindings is to use JSON notation.

It just so happens that jQuery (and JavaScript in general) works very well with JSON, and jQuery specifically abstracts out the cross-browser differences for a number of operations, including that of posting to a URL.

So yes, you would use classes that use the DataContractSerializer (which requires DataContract, DataMember), how you process it on the client side is up to you, it's just that jQuery makes it easier for you.

You could check out other frameworks, as most have some sort of functionality like this (to post data in JSON notation).

Upvotes: 1

Related Questions