Here's the specific code we're looking at:
ajax = function(url, cb)
{
xhr = (window.XMLHttpRequest)
? new XMLHttpRequest()
: new ActiveXObject('MicrosoftXMLHTTP');
xhr.onreadystatechange = function()
{
if (xhr.readyState == 4 && xhr.status == 200)
{
cb(xhr.responseText);
};
}
xhr.open('get', url, true);
xhr.send();
};
While there are pre-made libraries available, I'm currently experimenting with creating a more minimalistic library for my own needs. Do you spot any essential features missing from this function?