Custom Loading on Demand

Asked

Viewed 97 times

0

Hello folks would like to make a shipment on demand, but I’m not getting to assemble. Just follow my code:

function show(letra) {

    var itens = "";
    $.ajax({
        type: 'GET',
        dataType: 'json',
        data: 'action_search=yes&letra=' + letra,
        url: '<?= CAMINHO_ADMIN; ?>/modulos/responds.php',
        beforeSend: function () {
            $('.load').show();
            $('ul#alfabeto-itens').empty();
        },
        success: function (dados) {
            $('.load').hide();
            for (var i = 0; i < dados.length; i++) {
                $('ul#alfabeto-itens').append('<li class="hg-services__item"><a href="<?= BASE; ?>/exames/' + dados[i].post_name + '"><span>' + dados[i].post_title + '</span></a></li>');
            }

         }
    });

}
$(function () {

    $('tr#search-indexes').on('click', 'a.letra_click', function (e) {
        var res = $(this).attr('search-letra');
        $(this).siblings('a').removeClass('active');
        $(this).addClass('active');
        e.preventDefault();
        show(res);
    });

    }

});

Explanation of the above code: Starting the jquery function, I have a list of A-Z buttons, when I click on a letter, I return in json via ajax, everything that equals the letter clicked. This ajax request, is performed from Function "show(letter)", is in this function that I return to my php request with ajax and json, good apart from this function I can not make the load on demand, until found here and on the internet, Tutorials for charging on demand, no longer found with the type of structure I’m making.

So I wish someone could help me with this problem, I’d be grateful.

Att,

Alisson

  • From what I understand, you click a button of a letter, and returns from Ajax everything equal to the letter... and after that, what you want to do?

  • That’s for sure

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.