Use Javascript function within a PHP table column

Asked

Viewed 90 times

2

Hello,

I am calling a JS file in my index.php:

<script src="./Arquivos/js/ddtf.js"></script>

And within an echo I need to apply the function that exists within it:

<td><?php echo '<script>ddTableFilter('.$row['nome_cliente'].');</script>'?></td>

This JS file applies a check box to filter the selected name in the table column. Does anyone know where the error is ?

apache does not return any error, it just does not display any field in the column

  • The JS note is ok ? Anyway try so : <?php print ddTableFilter($row['nome_cliente']) ;?>

2 answers

1

Call the function inside the script, it would look like this

<td>
    <script>ddTableFilter(<?php echo $row['nome_cliente']; ?> )</script>
</td>

0


Try calling the function this way

<td>
   <script>ddTableFilter('<?php echo $row["nome_cliente"]; ?>')</script>
</td>

just remember to check if the function is already declared.

Browser other questions tagged

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