var xhr = null;
// This will be called when the request is complete
function processXHR() { … }
function update_table() {
// Should check for existing xhr connection
// For IE you'd use ActiveXObject("Microsoft.XMLHTTP")
xhr = new XMLHttpRequest();
xhr.onreadystatechange = processXHR;
// the 'this' variable refers to the text-field in this case
var url = '/api/contacts/search?term=' + escape(this.value);
xhr.open('GET',url,true);
xhr.send(null);
}