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
Related posts:
- Disabling debug in other than dev environment – Sys.InvalidOperationException If your web application using Microsoft Ajax (Ajax Control Toolkit),...
- Microsoft Application Architecture Guide 2nd Edition from Patterns & Practices Microsoft Patterns & Practices released the 2nd edition of...
- ASP.NET MVC – How to implement querystring In this tutorial, I would like to share with you...
- Tips: ASP.NET Webform Postback Twice If your ASP.NET webform is postback twice, then you are...
- Tips To Increase Performance of Store Procedure 1. NOCOUNTNormally if you perform query in Query Analyzer, it...
