Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

246
Visualizações
jquery html return php Uncaught SyntaxError: Unexpected identifier

I'm trying to jquery to return php value inside div I'm using .html() but I did get Uncaught SyntaxError: Unexpected identifier my html code is :

<script>
        $( document ).ready(function()
            $('#post-msg-<?= $divId ?>').html(`<?= \humhub\actions\TextFormatAction::text_html($model->message) ?>`);
        });
    </script>

on inspect element I see my php code is :

$( document ).ready(function() {
            $('#post-msg-e369853df766fa44e1ed0ff613f563bd').html('<p></p><img src="http://127.0.0.1/index.php?file=d2dd907d-bfd4-40ab-832f-bd8c161fd60e+" alt="" title="" />
<p> 
            <div class="div-div">
                <div>
                    <div class="div-title-description">
                        <h2>
                            <span class="div-title">Title-text</span>
                        </h2>
                        <p class="div-description">Description - text </p>
                    </div>                
                </div>
            </div>
        </p>
');
        });
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This is the way it should look like to work. You should have no line breaks in HTML from the html function.

<html>
<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>


<script>

$( document ).ready(function() {
            $('#post-msg-e369853df766fa44e1ed0ff613f563bd').html('<p></p><img src="http://127.0.0.1/index.php?file=d2dd907d-bfd4-40ab-832f-bd8c161fd60e+" alt="" title="" /><p><div class="div-div"><div><div class="div-title-description"> <h2> <span class="div-title">Title-text</span> </h2> <p class="div-description">Description - text </p>  </div> </div></div></p>');
        });
        
</script>
</body>
<div id="post-msg-e369853df766fa44e1ed0ff613f563bd">

</div>
        </html>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda