Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

279
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda