title: Jquery, ajax beforeSend not working
body: <p>These are the photo uploading code:</p>
  
  <pre><code>$.ajax({
      url: "php/uploadPhoto.php",
      type: "POST",
      data: formdata,
      processData: false,
      contentType: false,
      beforeSend: function(XMLHttpRequest){
          XMLHttpRequest.upload.addEventListener("progress", function(evt){
              if(evt.lengthComputable){
                  var percentComplete = evt.loaded / evt.total;
                  alert(percentComplete);
              }
          }, false);
      },
      success: function (res) {
  
      }
  });
  </code></pre>
  
  <p>It works if I do not add the "beforeSend" part....</p>