samedi 24 novembre 2018

Jquery promises whit objects

function uploadfiles(inputcontrol){ 
   //here the function takes all the files of an input files
   //for each inputcontrol.files[i]
   //createObject(inputcontrol.files[i]);
}

function createObject(files){ 
  //this function creates an object with each one of them the files 
  //are processed and loaded in a web service whit AJAX
}

when(uploadfiles()).then(alert('All files uploaded'));

When I run this script, the alert is displayed immediately and it does not wait for the files to be uploaded correctly. How should I run the $ .when?




Aucun commentaire:

Enregistrer un commentaire