Programmatically Speaking ...

This site

Fav Blogs

Sponsors

  • MaximumASP
  • Packet Sniffer

AJAX: JavaScript, or ASP .net AJAX or JQuery

 There are hundreds of AJAX frameworks and libraries. And the number is still growing (Face it, because the web, with the demand of rich data and fast, smooth user experience, is AJAXified overnight).

 However, I only know three: JavaScript AJAX, JQuery, and ASP.net AJAX.
 
JavaScript AJAX uses the very raw XMLHttpRequest. It's quite wordy, and needs to be always careful with different browser traps. That is, you always have to detect if XMLHttpRequest is supported, as such:
 
    var request;
    if (window.XMLHttpRequest())
        request = new XMLHttpRequest();
    else if(window.ActiveXObject)
        request = new ActiveXObject("Msxml2.XMLHTTP")
   else
      // throw an error here
 
ASP .net ajax is the Microsoft /asp .net team's approach to AJAX. It uses a ScriptManager and carries with it the quite bulk ASP .net ajax library. In the beginning, UpdatePanel, a partial postback web page refreshing model, plays a big role in ASP .net ajax, however, because of the heavy toll it exerts on bandwidth and performance, most people have abandoned its usage. ASP .net AJAX makes calling web service easy, and you get to use many of nice features in asp .net, such as membership, profile system.
 
JQuery has a number of functions that made AJAX easy. And as it is the case with JQuery, it is lightweighted and succinct. The list of functions are:
 
$.load (url, parameters, callback) : to load server response data to an element
 
$.get (url, parameters, callback): GET request with parameters
 
$.post (url, parameters, callback): POST request with paramenters
 
$.getJSON(url, parameters, callback): send a get request, response is interpreted as a JSON string
 
$.ajax (options) : send AJAX request with a number of options, including url, type, dataType, timeout, global, contentType, etc.

Comments

2008 October 22 - Links for today « My (almost) Daily Links said:

Pingback from  2008 October 22 - Links for today « My (almost) Daily Links

# October 22, 2008 3:49 AM