Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

276
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!