AJAX Presentation Outline

Updated , First Published by Pete Freitag

Here's an outline of the presentation on AJAX that I gave today at my ColdFusion users group meeting.

What is AJAX?

Examples of AJAX

Is it new?

Why is it popular?

Why is it bad?

Flash vs AJAX

XMLHttpRequest

XMLHttpRequest Properties

XMLHttpRequest Example

if (window.XMLHttpRequest) {
       var req = new XMLHttpRequest();
       req.onreadystatechange = requestStateHandler;
       req.open("GET", "/somefile.xml", true);
       req.send("");
}

function requestStateHandler() {
 if (req.readyState == 4) { //response ready
       alert(req.statusText);
 }
}

IE does it different

Cross Browser AJAX

var req;

function loadXMLDoc(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send("");
	}
}

Source: developer.apple.com/internet/webcontent/xmlhttpreq.html - a great AJAX tutorial BTW.

AJAX Libraries

Prototype Example

I posted the AJAX prototype example that I showed in the presentation in another entry.

The Fixinator Code Security Scanner for ColdFusion & CFML is an easy to use security tool that every CF developer can use. It can also easily integrate into CI for automatic scanning on every commit.