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?
- // Savanna.ShowLoading(true, "Please wait..");
- var formData = new FormData();
- formData.append("customer_id", customer_id);
- $.ajax({
- type: "POST",
- url: "https://www.domain.com/get_customer_by_id.php",
- async: false,
- data: formData,
- dataType: "json",
- processData: false,
- contentType: false,
- beforeSend: function () {
- Savanna.ShowLoading(true, "Please Wait..");
- },
- success: function (data) {
- if (data) {
- is_organization = Boolean(data[0].is_organization);
- custom_id = data[0].custom_id;
- customer_title = data[0].title;
- first_name = data[0].first_name;
- middle_name = data[0].middle_name;
- last_name = data[0].last_name;
- }
- else {
- DevExpress.ui.dialog.alert('Unable to find customer details.', 'Customer').done(function () {
- Savanna.app.navigate({ view: "home" }, { root: true });
- });
- }
- },
- error: function (xhr, status, error) {
- Savanna.ShowErrorDialog('Failed to get cutomer details!<br>Please check your connection.');
- },
- complete: function () {
- Savanna.ShowLoading(false, "Please Wait..");
- }
- });
Thanks,