Countdown of a list passing in an if

Asked

Viewed 75 times

0

I have an email list from a database, but I just want to send it to the ones marked with checkbox. If I’ve scored 10, I want you to dial one down, every time you go through the if, and when you pass show the number and when you’re done show a message.

For example: I marked the ten and click send, can be in a modal, show the numbers decreasing and then a message as completed.

Any idea or tip is welcome.

  • just one comment on the "UI": This type of UI is very 90 years, where it took a lot of time to send an email, nowadays to async tools to send and API’s that take only 1 second to send an email... Just send it to all emails (1 single email with bcc from the list is sufficient) and shows the page n emails sent... to select all the checkbox marked, with jQuery is simple: $("checkbox:checked")

  • First, it would be interesting for you to tell us what technology you’re using in Server-Side, Java. NET, Nodejs, etc. In any case, if you are sending a "Direct Mail", where each email is customized to the recipient, you can send the mailing list, the server return a ticket and continue processing them, then you can use this ticket to check the progress of the process. another option, would be the server notify the browser through a Websocket.

1 answer

0


You can just use setIntervalto apply the reduction in the values according to the time and, after the end, clear the execution:

var emailsToSend = 10;
var counter = document.getElementById("counter");
var interval = setInterval(function() {
  counter.innerHTML = emailsToSend;
  if (emailsToSend === 0) {
    clearInterval(interval);   
  }
  emailsToSend--;
}, 150);

Example: http://jsfiddle.net/haskellcamargo/gs2proL7/

  • I already have the system that sends, it’s just like a counter to show in a div or modal when the system goes through if. Still thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.