Saturday, February 7, 2009

Crazy javascript

What is that InstallFunction doing?
 
function doAdd() {
server
.Add($('num1').value, $('num2').value, onAddSuccess);
}

function InstallFunction(obj, name) {
   obj[name] = function() { Request(name, arguments); }
}

var server = {};
InstallFunction(server, 'Add');


Where Request is a method that encapsulates and simplifies an AJAX call

No comments: