onreadystatechange is an event handler property of the XMLHttpRequest object, not a method. It's a property that you assign a function to (xhr.onreadystatechange = function(){}), not a method that you call. Methods are invoked with parentheses, properties are assigned values.