Links returned by php do not work

Asked

Viewed 32 times

0

Hy, To with a problem with my links that are returned via php, basically it doesn’t work, the right link ta has nothing broken just doesn’t work. I want to know how to make them clickable.

print:

inserir a descrição da imagem aqui

html::

   <main class="main">
    <form class="form">
    <label for="" title="Procurar anime"> Procurar Anime</label>
        <div class="form-group">
            <input type="text" class="search" placeholder="Buscar anime..">
            <button type="submit"><i class="fas fa-search"></i></button>
            <div class="auto-complete">
                <ul>
                </ul>
            </div>
        </div>
    </form>
</main>

<script src="<?php echo BASEJS.'search.js' ?>"></script>

php::

  <?php

include_once('../config/config.php');

if(!empty($_POST['search']))
{
    $search = $_POST['search'];

    $search = '%'.$search.'%';
    $searchAnime = $crud->select('*',"animesmal",'WHERE name LIKE ?  LIMIT 5')->run([$search]);
    $ContResultRow = $searchAnime->rowCount();

    if($ContResultRow == 0)
    {
        echo '<span class="result-not">Resultado não encontrado.<span>';
    }

    else{

        $row = $searchAnime->fetchAll(PDO::FETCH_ASSOC);
        foreach ($row as &$value) {


            echo '<li>'.'<a href="home.php">'.$value["name"].'</a>'.'</li>';

        }

    }
}

JS::

    // animação do campo de pesquisa
    $(document).ready(function()
    {
        $('.search').focusin(function()
        {

            $('button').animate({'right': '48px'},100); // Move o btn de pesquisa


            // Verifica se o auto-complete ta aparecendo 
            if($('.auto-complete').css('display') == 'block')
            {
                $('.search').css('border-radius','7px 7px 0px 0px');
            }
        })


        $('.search').focusout(function()
        {
            $('button').css('right', '68px'); // Move o btn para o local de origem

            $('.search').css('border-radius','30px'); // Volta o border-radius ao normal

            $('.auto-complete').css('display', 'none'); // Deixa o auto complete invisivel
        })

    })


    // Pega o que está sendo digitado e envia por ajax
    $('.search').focus( function () {

    var timer = 0;

    var input = $('.search');

    input.keyup(function (e) {

        var code = e.keyCode ? e.keyCode : e.which;

        if (code > 45 || code === 32 || code === 8 || code === 13) {

            clearTimeout(timer);

            timer = setTimeout(function () {

                input = $('.search').val() // pega o valor do campo
                ajax(input); // chama o ajax e passa o valor do campo
            }, 200);
        }
    });
    })


function ajax(i){
    search = i;
    $.ajax({
        url : 'result.php',
        type : 'post',
        data : {'search':search},

        success: function(retorno){
            $('.auto-complete').css('display', 'block');
            $('.search').css('border-radius','7px 7px 0px 0px');
        $('.auto-complete ul').html(retorno);
        },
        error: function(erro){
        $('#resposta').html(erro);
        }       
    })
}
  • How come it doesn’t work? Explain it a little better.

  • I click and it doesn’t happen nd, simple.

  • But the little mouse hand appears when you put it on top?

  • echo '<li>'.'<a href="home.php">'.$value["name"].'</a>'.'</li>'; you are not always directing towards the home.php ???

  • Yeah, like everything seems to be normal, the link is right, just nothing happens it doesn’t change pages or anything.

  • It’s just for testing, I’ve tried to point to google.com to test tmb and type does not happen nd

  • Include the rendered html of the page

  • Go to F12 and inspect the link... take a print of the code and ask the question

  • ready to add the print

Show 4 more comments
No answers

Browser other questions tagged

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