jQuery can simplify the AJAX call for a RESTful service. So, when we need to consume a RESTful service and then rendering the received XML/JSON data in a Web Application, jQuery automatically becomes a good option.

In this WCF tutorial, we will call a simple RESTful service using a GET request and then display the received data. Since its a continuation of my previous article, I am will not create a new RESTful service now. Please go through my last article "5 simple steps to create your first RESTful service", I will call the same service I created there.

As in the above article, I created a project using Visual Studio 2010 named "MyRESTService". So, we will add a new client project to the same existing solution.

1. Add client project to the same solution.

You can now see two projects under a solution. MyRESTService project and the new MyRESTClient project.

ima2.jpg

2. We will call that existing service using jQuery's Ajax function in our MyRESTClient project.

</script>

The jQuery Ajax function basically performs an asynchronous HTTP request with parameters, as I mentioned in bold.

When you run the application, it will call the service, the data is fetched and displayed in a tabular format as shown in the following figure.

ima4.jpg

Now, hopefully, you can create a simple WCF RESTful service and consume it using jQuery as well. My next article will contain all Create, Read, Update, Delete (CRUD) operations for the RESTful service.