passing string to event listener giving NULL
<p>I have the following piece of code. The string is being sent to <code>uploadFile</code> correctly but the line <code>alert(str)</code> is giving me <code>undefined</code>?</p>

<pre><code>function uploadFile(str){
    alert(str); //prints correctly
    var fileTag = document.getElementById('fileinput');
    var file = fileTag.files[0];
    var xmlhttp=new XMLHttpRequest();
    var formData = new FormData();
    formData.append("thefile", file); 
    xmlhttp.addEventListener("load", function(evt,str){
         alert(str); //undefined
    }, false);
    ....
}
</code></pre>

<p>I'm fairly new to javascript, so can anyone tell me why this is happening? thank you</p>
