Michael MoncurNow I could jump in here and point out that "Ajax" is a catch-all term for a collection of vague concepts, and we just killed the term DHTML for the same reason, but at least this one doesn't include "HTML" in its name, and besides, nobody likes to pronounce 'XMLHttpRequest'.
Jeremy Keith[Ajax] straddles the worlds of client-side and server-side scripting [...] To use this technology correctly, developers need to understand both worlds. The concept of progressive enhancement is probably a new one to server-side programmers while the idea of data abstraction may be new to client-side developers.
Steve JensonBy defining an architectural style as its building materials and not with its underlying philosophy, it will quickly become obsolete. In fact, it's already obsolete: Google Suggest doesn't use XML for data interchange; just JavaScript arrays. Gmail also doesn't use XML and it doesn't use standards-based markup for presentation. Are they no longer Ajax applications? Of course they are.
Cameron AdamsAlthough it has been around for a while, in terms of its usage JavaScript data retrieval is still a very immature technology. The uses which I have seen are either for manipulation of form data (Google Suggest), or complete web applications (Google Maps, GMail, map.search.ch). The reason that there is no inbetween is because, as with all JavaScript solutions, JavaScript data retrieval has an Achilles heel: you can never rely on a client to have it or allow it.
Jason FriedHowever, let's proceed with caution. What we're talking about is technology, not the user experience. Ajax-based apps certainly have the potential to produce a better user experience, but good experiences never come by default. Good experiences aren't plugged in. Good experiences are crafted by thinking about people, not technology.
function XHR(){var xmlhttp=false;
/*@cc_on @*//*@if (@_jscript_version >= 5)
try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){
try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(E){xmlhttp=false;}}
@else
xmlhttp=false;
@end @*/if (!xmlhttp && typeof XMLHttpRequest!='undefined'){
try{xmlhttp=new XMLHttpRequest();}catch(e){xmlhttp=false}
}return xmlhttp;}
function getData() {
var _xhr = XHR();
_xhr.open("GET", "/hello-world.txt", true);
_xhr.onreadystatechange = function() {
if (_xhr.status==200) { // http status OK
if (_xhr.readyState==4) { // parsed
alert(_xhr.responseText);
}
} else {
alert("Errrr."+_xhr.status);
}
}
_xhr.send(null);
}
function RST(src) {
var st = document.createElement("script");
st.type = "text/javascript";
st.src = src;
var h = document.getElementsByTagName('head');
if (h && h.length>0) h[0].appendChild(st);
}
Cameron Adams... JavaScript is brilliant for presenting content in web applications, but inadvisable for presenting content on web pages. It'll still let you do cool things – really useful things – but it shouldn't change the way that websites are built or used, because 99% of the Internet is not an application.