Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Modal show before get results function but not hide after it

I want to show "Please wait" on modal when LoadScreen function end. My Modal show is working , But not hide after Loadscreen function; My Modal is simple. Only "Please wait..." displaying.

        $(document).ready(function () {

            $('#myModal').modal('show');
            LoadScreen('0', Page.toString());
            $('#myModal').modal('hide');
        });

My LoadScreen() Function;

function LoadScreen(SekmeID, Page) {
    var KartID = getUrlParameter2('KartID');
    var ID = getUrlParameter2('ID');

    if (KartID == null) {
        KartID = 0;
    }

    if (ID == null) {
        ID = getUrlParameter2('id');
        if (ID == null) {
            ID = 0;
        }
    }

    $.ajax({
        url: 'gridsayar.asmx/GetGrid',
        data: "{SekmeID: '" + SekmeID + "',KartID:'"+KartID+"',ID:'"+ID+"',Page:'"+Page+"'}",
        dataType: "json",
        async: false,
        type: "POST",
        contentType: "application/json; charset=utf-8",
        success: function (data) {
                $("#Grid01").html(data.d);
            }
        },
        error: function (response) {
            $("#ARADIV").html('<font color="Red">'+response.responseText+'</font>');
            alert('Hata Kodu : Grid Getirme Hatası : ' +Page);
        },
        failure: function (response) {
            //$("#TextError").val(response.responseText);
            alert('Basarisilik Kodu : Grid Getirme Başarısız Oldu :'+Page);
        }

    });


}

I changed my code. I added beforesend and complate to my ajax. Bu stil not show my new span(please wait).

$.ajax({
        url: 'gridsayar.asmx/GetGrid',
        data: "{SekmeID: '" + SekmeID + "',KartID:'"+KartID+"',ID:'"+ID+"',Page:'"+Page+"'}",
        dataType: "json",
        async: false,
        cache: false,
        timeout: 30000,
        type: "POST",
        contentType: "application/json; charset=utf-8",
        beforesend: function () {
            $("#ajaxloading").show();
            alert('beforesend');
        },
        complate: function () {
            $("#ajaxloading").hide();
            alert('complate');
        },
        success: function (data) {
                $("#Grid01").html(data.d);
        },
        error: function (response) {
            $("#ARADIV").html('<font color="Red">'+response.responseText+'</font>');
            alert('Hata Kodu : Grid Getirme Hatası : ' +Page);
        },
        failure: function (response) {
            //$("#TextError").val(response.responseText);
            alert('Basarisilik Kodu : Grid Getirme Başarısız Oldu :'+Page);
        }

    });

Comments