| By Dave Ward | Article Rating: |
|
| July 21, 2009 05:00 PM EDT | Reads: |
1,415 |
As jQuery’s popularity in the .NET community has risen over the past year, one recurring theme I’ve seen is the desire to refactor away the details of using it to call ASP.NET AJAX services. Whether through helper function or specialized jQuery plugin, I’ve seen numerous methods proposed and/or in use.
Personally, the syntax never bothered me. The contentType parameter is ugly, but I have a Visual Studio code snippet for the $.ajax call and rarely think about it.
That came to an end earlier this year, when I started using dataFilter. I needed to isolate my code from the “.d” issue, and wanted to take advantage of browser-native JSON parsing in Firefox 3.5 and IE8, which required a bulky dataFilter.
Repeating that entire callback function in every $.ajax call was not acceptable. So, I was happy to learn that jQuery provides an excellent solution for consolidating settings to be used in multiple instances of $.ajax.
In this post, I’ll show you how to use that consolidation feature, and exactly how I am now using that to more simply call ASP.NET AJAX services with jQuery.
Click here to continue reading: Simplify calling ASP.NET AJAX services from jQuery
Published July 21, 2009 Reads 1,415
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Dave Ward
Dave Ward wrote his first computer program in 1981, using good ‘ol Microsoft Color BASIC and cassette tapes for data storage. Over the years since then, he has had the opportunity to work on projects ranging from simple DOS applications to global telecommunications networks spanning multiple platforms.
- A Sneak Peak at ASP.NET AJAX 4.0’s Client-Side Templating
- Simplify Calling ASP.NET AJAX Services From jQuery
- Improving jQuery’s JSON Performance and Security
- $(document).ready() and pageLoad() are not the same!
- Automatically minify and combine JavaScript in Visual Studio
- How I handle JSON dates returned by ASP.NET AJAX
- Use jQuery to catch and display ASP.NET AJAX service errors
- 11 keystrokes that made my jQuery selector run 10x faster
- Highslide JS .NET v4.1.4
- Review: The best JavaScript book I’ve read
- PostBack Ritalin v1.0
- What ASP.NET developers should know about jQuery
























