beforeSend not working with async

beforeSend not working with async

Hi,

I am using below ajax with async = false but my issue is it is not showing the loading panel in beforeSend.

However, if I change async to true then beforeSend will show the loading panel.

How can I overcome this issue?

  1. // Savanna.ShowLoading(true, "Please wait..");

  2. var formData = new FormData();

  3. formData.append("customer_id", customer_id);

  4. $.ajax({
  5.     type: "POST",
  6.     url: "https://www.domain.com/get_customer_by_id.php",
  7.     async: false,
  8.     data: formData,
  9.     dataType: "json",
  10.     processData: false,
  11.     contentType: false,
  12.     beforeSend: function () {
  13.         Savanna.ShowLoading(true, "Please Wait..");
  14.     },
  15.     success: function (data) {
  16.         if (data) {
  17.             is_organization = Boolean(data[0].is_organization);
  18.             custom_id = data[0].custom_id;
  19.             customer_title = data[0].title;
  20.             first_name = data[0].first_name;
  21.             middle_name = data[0].middle_name;
  22.             last_name = data[0].last_name;
  23.         }
  24.         else {
  25.             DevExpress.ui.dialog.alert('Unable to find customer details.', 'Customer').done(function () {
  26.                 Savanna.app.navigate({ view: "home" }, { root: true });
  27.             });
  28.         }
  29.     },
  30.     error: function (xhr, status, error) {
  31.         Savanna.ShowErrorDialog('Failed to get cutomer details!<br>Please check your connection.');
  32.     },
  33.     complete: function () {
  34.         Savanna.ShowLoading(false, "Please Wait..");
  35.     }
  36. });


Thanks,