title: SweetAlert 2 and Internet Explorer
body: <p>So basically we are using SweetAlert2 on our website.
  Everything is running well on various web browsers like Chrome, Firefox, Edge except Internet Explorer.</p>
  
  <p>At first - as almost everyone know - SweetAlert2 is using arrow functions which are not supported by Internet Explorer. However, as we also know - the Internet Explorer is not supporting arrow functions so we decided to overwrite arrow function with classic function.</p>
  
  <p>From:</p>
  
  <pre><code>Swal.fire({
      title: 'Success',
      html: message,
      icon: 'success'
      }).then((result) =&gt; {
          window.location.reload();
  });
  </code></pre>
  
  <p>We get to this:</p>
  
  <pre><code>Swal.fire({
      title: 'Success',
      html: message,
      icon: 'success'
      }).then(function (result) {
          window.location.reload();
  });
  </code></pre>
  
  <p>And yes, the code from above make it works on Internet Explorer. We were happy until we realise that this kind of code also results in problems with AJAX POST requests so almost all functions in the application stopped to work. </p>
  
  <p>Otherwise - if we switch back to arrow functions in SweetAlert2 call method - then all of our ajax post requests are working without any problems.</p>
  
  <p><strong>@edit => More information about scenario</strong></p>
  
  <p>So after the ajax call - the post data is beeing send to the php file which checks if post data has been sent by using isset() method. If so then it makes query to the database, elseway it returns error code.</p>
  
  <p>In scenario when we use arrow functions - isset() checking post data returns true and there is a query.</p>
  
  <p>In scenario when we dont use arrow function - isset() checking post data returns false and the ajax call is returning errorcode.</p>
  
  <p><em>So it looks like the post data from the form is not beeing send.</em></p>
  
  <p><strong>@edit2 - adding js function code in the link below</strong></p>
  
  <pre><code>$('.form-ajax').on('submit', function(event) {
  
      event.preventDefault();
  
      var link = $(this).attr('action');
      var redirect = false;
      var callback = false;
  
      // Sweet Ajax
      var confirm_question = false;
      var success_msg = false;
  
      if ($(this).attr('redirect')    !== undefined)      { redirect = $(this).attr('redirect'); }
      if ($(this).attr('callback')    !== undefined)      { callback = $(this).attr('callback'); }
  
      // Sweet Ajax
      if ($(this).attr('confirm')         !== undefined) { confirm_question = $(this).attr('confirm'); }
      if ($(this).attr('success')         !== undefined) { success_msg = $(this).attr('success'); }
  
  
      if (confirm_question !== false) {
  
          // Pytanie zostało określone
          Swal.fire({
              title: 'Potwierdzenie',
              html: confirm_question,
              icon: 'warning',
              showCancelButton: true,
              confirmButtonColor: '#3085d6',
              cancelButtonColor: '#d33',
              confirmButtonText: 'Potwierdź',
              cancelButtonText: 'Anuluj'
              }).then(function (result) {
              if (result.value) {
  
                  $.ajax({
                      url: link,
                      type: 'POST',
                      data: $(this).serialize(),
                      success: function(result) {
  
                          if (result == 'ok') {
  
                              var komunikat = 'Operacja została wykonana poprawnie.';
  
                              Swal.fire({
                                  title: 'Sukces',
                                  html: komunikat,
                                  icon: 'success'
                              }).then(function (result) {
                                  if (redirect) {
                                      window.location.replace(redirect);
                                  } else {
                                      window.location.reload();
                                  }
                              });
  
                          } else {
  
                              if (result == '405') {
  
                                  if (callback) {
                                      $('#' + callback).html('&lt;i class="fas fa-exclamation-circle"&gt;&lt;/i&gt; Wystąpił błąd1. Odśwież stronę i spróbuj ponownie.');
                                  } else {
  
                                      // swal fire
                                      Swal.fire({
                                          title: 'Błąd',
                                          html: 'Wystąpił błąd. Odśwież stronę i spróbuj ponownie.',
                                          icon: 'error'
                                      });
  
                                  }
  
                              }
                          }
                      }
                  });
  
              }
          });
  
      }
  
  });
  </code></pre>
  
  <p>Above function returns "Wystąpił błąd1. Odśwież stronę i spróbuj ponownie." if we are not using arrow functions which means that result is returning 405.</p>
  
  <p>We are stuck and dont know what else we can try?</p>