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

277
Visualizações
Append Table row to existing Table PHP, Javascript

I'm trying to make a Table where the user is able to see some data from a database.

To do this im using this js code to append a row for every entity:

     function append(id, name){
    $table_body = $('#tbody');
    //html of the table row
    $table_row = $('<tr class="edit" id="' + id + '"> <td></td><div class="checkbox"> <label><input type="checkbox" name="checkbutton">checkbox</label></div><td>' + name + '</td></tr>');
    //append row
    $table_body.append($table_row);
    $('#avatartable').show();
  }

with that code I'm gettin this error: Uncaught ReferenceError: $ is not defined

I'm pretty sure the dollar sign is needed though and I don't know what I can do now.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

As far as I know, you can NOT combine PHP and JavaScript at the same time in a function (execept to write the js code with echo or something similar)! -Php is a back-end language (executed in server) -JS is a front-end language (executed in browser)

if all you want is to display data from database into a HTML table just put a php script inside the tbody, loop through your array an echo the rows something like

foreach($array as $value)
    echo '<tr><td>'.$value.'</td><td>...</td></tr>';
about 4 years ago · Juan Pablo Isaza Relatório

0

Include jQuery script in your html.

Insert this line inseide in your html file

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
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