title: Http request is sending 2 times through AJAX
body: <p>My AJAX code is as follows:</p>
  
  <pre><code>data = new FormData();
     //  data="";
      paths = "";
  
  
      // Create a new HTTP requests, Form data item (data we will send to the server) and an empty string for the file paths.
      xhr = new XMLHttpRequest();
  
  
      // Set how to handle the response text from the server
      xhr.onreadystatechange = function(ev){
          //console.debug(xhr.responseText);
       //  console.log("success"+xhr.responseText);
  
      try{
        console.log($.parseJSON(xhr.responseText));
  
         var data=$.parseJSON(xhr.responseText);
  
        if(data.success=="yes"){
  
            projectCounter++;            
            var projectName=$.parseJSON(data.arguments);
            console.log(projectName.projectName);
  
            console.log('update table');
  
            if(projectCounter==2){
  
                UploadComplete(projectName.projectName);
  
            }
  
  
        }
  
       } 
       catch(e){}
  
      };
  
      // Loop through the file list
      for (var i in files){
          // Append the current file path to the paths variable (delimited by tripple hash signs - ###)
          paths += files[i].webkitRelativePath+"###";
          // Append current file to our FormData with the index of i
          data.append(i, files[i]);
      };
      // Append the paths variable to our FormData to be sent to the server
      // Currently, As far as I know, HTTP requests do not natively carry the path data
      // So we must add it to the request manually.
      data.append('paths', paths);
      // console.log(paths);   
      // Open and send HHTP requests to upload.php
      xhr.open('POST', "upload.php", true);
       console.log(data);   
  
      xhr.send(this.data);
  </code></pre>
  
  <p>the issue i am facing is that it is sending http request 2 times. I am recieving Http response 2 times. I have written console.log("update Table") and it is showing 2 times. I am very confused why i am recieving 2 times Http response instead of the fact that i am sending only 1 request?</p>