How to view jquery in php

Asked

Viewed 140 times

2

How to display in echo jQuery? I tried to do this and it’s not working:

public function InsereComentarioNoBanco($ip,$nome,$mensagem,$horario) {
    echo "
        <script>
            $('.nomeClas').hide();
            $('.nominho').hide();
        </script>
    ";

    $ConsultaDeInsercao = $this->pdo->query("insert into usuariochat SET mensagem = '$mensagem',nome = '$nome',horario = '$horario',ip = '$ip' ");

    if($ConsultaDeInsercao == true) {

            return "aff";
    }else { echo "ERRO NA INSERÇÃO DO COMENTÁRIO";}
  • At what point is this method executed? On the basis that you claim it does not work? What was the result obtained and what was expected?

  • Once you enter this chat for example, this method will be called, sending the comment to the bank, and soon after will show the comment on that obscenity page. The expected was for div to disappear and nothing happened.

  • Does it work? What I did is allowed ?????

1 answer

1

<script>
//Nao esqueca o caminho do jquery.js

    function Hide() {
        console.log("ok");
        $('.nomeClas').hide();
        $('.nominho').hide();
    }

</script>

<?php
/*
 * Insere comentario
 */

function InsereComentarioNoBanco($ip, $nome, $mensagem, $horario)
{
    /*
     * Chama o function
     */
    echo "<script>Hide()</script>";

    $ConsultaDeInsercao = $this->pdo->query("insert into usuariochat SET mensagem = '$mensagem',nome = '$nome',horario = '$horario',ip = '$ip' ");

    if ($ConsultaDeInsercao == true) {

        return "aff";
    } else {
        echo "ERRO NA INSERÇÃO DO COMENTÁRIO";
    }
}

Browser other questions tagged

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