Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var buscarProduto = $(this).val();
- var idcategoria = $(".active-button").attr("id");
- var mostraPesquisa = "";
- if(buscarProduto.length == 0)
- {
- $('.item-selecionado').fadeIn();
- }
- else
- {
- $.ajax({
- url: 'http://api.teste/store/produtos?filter[categoria_id]=' + idcategoria + '?like[nome]=' + buscarProduto + '',
- method: 'GET',
- dataType: 'json',
- success: function(retorno)
- {
- $.each(retorno.data, function(i, item)
- {
- alert(item.nome);
- // mostraPesquisa += '<li class='item-pesquisado'><span class=''>Nome do Lanche</span></li>';
- })
- $('.item-selecionado').fadeIn();
- $('.item-selecionado').html(mostraPesquisa);
- },
- error: function(XMLHttpRequest, textStatus, errorThrown)
- {
- alert("Status do Servidor: " + textStatus);
- alert("Erro do Servidor: " + errorThrown);
- }
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement