I'm trying to figure out why my ajax script is not working. For example only (not complete code):

request = new XMLHttpRequest();
request.onreadystatechange = function () {
if(request.readyState == 4) {
if(request.status ==200) {
some code }

Can I name this function by putting a name between the word "function" and the "()" on the

"request.onreadystatechange = function() {" line above, then call it by name with an event handler?

Even though this code is incomplete, did I make any mistakes?