Loading Screen - I can not get javascript function to hide the "Loading .." screen works

0

Expensive, good afternoon.

I have this part that works fine when the link is clicked:

<div class="input-group">
    <input type="text" id="txtVenda" class="form-control" />
    <span class="input-group-btn">
        <a href="javascript:void(null);" class="btn btn-primary" id="btnPesquisar" onclick="showProgress();">Pesquisar</a>
    </span>
</div>

calling this function:

<script type="text/javascript">
    function showProgress() {
        var updateProgress = $get("<%= UpdateProgress1.ClientID %>");
        updateProgress.style.display = "block";
    }

So far so good ... The problem is that after clicking the link, data is read in the bd to populate a table ... and anyway, I do not know at what time, or place I will be able to call the function below:

    function hideProgress() {
        var updateProgress = $get("<%= UpdateProgress1.ClientID %>");
        updateProgress.style.display = "none";
    }
</script>

Can anyone give me a help? Tks!

Follow the page that was supposed to have the "Wait for Loading ..." effect:

            <div class="input-group">
                <input type="text" id="txtVenda" class="form-control" />
                <span class="input-group-btn">
                    <a href="javascript:void(null);" class="btn btn-primary" id="btnPesquisar" onclick="showProgress();">Pesquisar</a>
                </span>

                <%--<a href="javascript:void(null);" class="btn btn-primary" type="button" onclick="javascript:wassamaraShow('#resultados-div');">Pesquisar</a>--%>
                <%--<a href="javascript:void(null);" runat="server" id="btnPesquisar" class="btn btn-primary" type="button" onclick="onSearch">Pesquisar</a>--%>
                <%--</span>--%>
            </div>
        </div>
    </div>

    <div id="noResult" style="display: none;">
        <hr />
        <h3>Resultados da Pesquisa</h3>
        <!-- sem resultado -->
        <div class="alert alert-warning" runat="server" visible="true">Nenhum item localizado.</div>
        <!-- sem resultado -->
    </div>
    <!-- resultados -->
    <div id="resultados" style="display: none;">
        <!-- com resultado -->
        <div>
            <table class="table table-hover" id="tableVendas" style="display: none;">
                <thead>
                    <tr class="active">
                        <th>Empreendimento</th>
                        <th>Tipo de Pagamento</th>
                        <th>Dados da Conta</th>
                        <th>Data Agendamento</th>
                        <th>Status</th>
                        <th>Valor</th>
                        <th style="text-align: right;">Ações</th>
                    </tr>
                </thead>
                <tbody id="vendaBody">

                </tbody>
            </table>

        </div>
        <!-- com resultado -->
    
asked by anonymous 06.10.2017 / 21:02

1 answer

0

Solved this way:

        $('#btnPesquisar').click(function () {
            $.when(
                $.ajax({
                    method: 'GET',
                    url: '<%= ResolveUrl("LiberarBoleto.aspx/onSearch") %>',
                    contentType: 'application/json; charset=utf-8',
                    dataType: 'json',
                    data: { pv: JSON.stringify($('#txtVenda').val()), imob: JSON.stringify($('#drpDownImob').val()) },
                    success: function (result) {
                        //console.log('Passo 1')
                        ////showProgress();
                        //// console.log ('Sleep')


                        //console.log('Passo 2')
                        ProcessVendas(result)

                        //console.log('Sleep')
                        sleep(1000);


                    }
                }).then(showProgress())).done(function () { hideProgress() })



        });
    
16.10.2017 / 18:51