i have a php variable that holds a date and i want to pass to a javascript function, but what happens is that i get a junk value instead, what should i do?
$data = $_POST['datep'];
echo "<script language=javascript>fnClickAddRow($nplaca,$defeito,$posicao,$data);/script>";
<script type="text/javascript">
function fnClickAddRow(n__placa,defeito2,posicao2,dataf) {
var lext = "<?php echo $l_ext ; ?>";
$('#table1').dataTable().fnAddData( [
lext,
n__placa,
defeito2,
posicao2,
dataf
]);
}
</script>
everything except dataf prints fine on the table (datatables).
the $l_ext wasnt working either until i found this solution (echoing to the var), but doing the same for dataf doesnt work ($l_ext is GET instead of POST)
if i echo the $data on php (before calling the javascript function) i can see the date on the format i want (dd/mm/yyyy) but after it passes to javascript i can see only a string of numbers (0.00048958943893).
thanks