AJAX-enabled WCF Service :: Getting Started
Once you know how to configure the WCF services; they are great! There is built-in AJAX-enabled WCF Service template that one can use to create a server side peace of the modern AJAX base web app. The more recent option is Web-Api; but it requires that you can make changes in the RouteTable and when you cant; AJAX-enabled WCF Service can be used!
Once it gets added; it adds the following configurations in the web.config; note the three important section that together make the WCF; AJAX enabled!
By default; the service returns the data in JSON format; if we want to return in XML; we can use the WebGet attribute at method level and set the content type accordingly; as highlighted!
This is all great; but seeing jQuery popularity; Microsoft decided to abandon their MS AJAX library and instead introduced three jQuery plugins; one for templating; one for data linking and the last one for globalization. The templating plugin also reached till Beta; we can access our service and can have the templating in place with the following code!
Templating just resolve JSON to DOM problem; for the remaining CUD operations of typical CRUD requirement needs DOM to JSON functionality as well. In next post of this series; we will revisit this and will also add Update / Save functionality