How to deal with the variable number of ajax loops in jQuery deferred?

We want to upload multiple images on ajax. The number of images uploaded varies from 2 to 10 at a time. We want to do follow-up operations after all uploads such as deferred are completed.
you can use
$.when (ajax1,ajax2)
.done (.)
.fail (.)
, but the question is how many loops we need in our when () depends on the number of user images. How do we deal with this?
Thank you.

Mar.25,2022

apply find out.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b45e49-2c019.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b45e49-2c019.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?