Ajax async file upload with redirect

Ajax async file upload with redirect

Hi All,

I am trying to upload file where I am having few conditions to satisfy
1. Ajax Call is asynchronous.
2. User should not be waiting to get file uploaded, Uploading process should be in background.
3. User should be redirected to next page as he submits form.

Here's what I am trying to do.

___________________________________________________________

$("#Apply_Now").submit(function (event) {
   event.preventDefault();
   var data = new FormData();
   var firstname = $("#firstname").val();

   var files = $("#resumeFileUpload").get(0).files;
   if (files.length > 0) {
    data.append("upload", files[0]);
   }
   
        data.append("firstname", firstname);
        
        
   var ajaxRequest = $.ajax({
       type: "POST",
       url: 'file/uploadData',
       data: data,
       processData: false,
       contentType: false 

                  // no success or fail because I dont want user to wait for completing the request
                  
   });
            window.location = " http://www.google.com/";
});
_____________________________________________________________

Thanks in advance.