title: Wait until while loop with request is finished
body: <br>
  I have a date rangepicker where I select two dates. Then I check via an API for each day in a while loop if it is a holiday. Unfortunately I can't get the right result.
  I only get 0. Where is the mistake?
  <pre><code>function(start, end, label) {
              var from = new Date(start.format('YYYY-MM-DD'));
              var to = new Date(end.format('YYYY-MM-DD'));
              var loop = new Date(from);
              let days = 0;
              while (loop &lt;= to) {
                  let day = (&quot;0&quot; + loop.getDate()).slice(-2);
                  let month = (&quot;0&quot; + (loop.getMonth() + 1)).slice(-2);
                  let myday = (day) + &quot;.&quot; + (month) + &quot;.&quot; + loop.getFullYear();
                  $.get(&quot;https://ipty.de/feiertag/api.php&quot;, {
                      'do': &quot;isFeiertag&quot;,
                      'datum': myday,
                      'loc': &quot;BW&quot;
                  }).done(function(data) {
                      if ('0' == data) {
                          days++;
                      }
                  });
                  var newDate = loop.setDate(loop.getDate() + 1);
                  loop = new Date(newDate);
              }
              console.log(days);
          }
  </code></pre>