Step towards Web 2.0 development nowdays, ajax is one of the important element in web development. There are various way of doing asynchronous call to server or web service to execute a job.
In this post, I am using jQuery to consume ASP.NET handler through a simple javascript codes. In the normal scenario, if client side requesting a simple string, server just have to return response context with plain/text. If you wish to return a set of data to be return in formatted string, you can either have the options like text/xml or application/json. My example code here will be using application/json with the assistance of third party component, Newtonsoft Json.
Scenario
“I Wish to use javascript to execute a job asynchronously to ASP.NET and receiving set of data in object. I do not wish to make my asynchronous call to any of my ASP.NET aspx pages because it is not a best practice. How can I do it?”
Expectation
- Data return from server in JSON object
- Calling ASP.NET handler
- Using jQuery
Prerequisite Component
- jQuery 1.3.2
- Newtonsoft Json
Solution File Structure

Download hellojson_050509_1229


