Talk to people, blz? I am a beginner in php and I have a populated table with while and I need to use the value of a td in a select on another page returning in a modal. The structure I set up works by putting the value manually into the script, but when I look directly from the table there is no information at all.
When I change Date: {expense: expense}, to Date: {expense: 4}, the data goes correctly to Div in Modal, otherwise only the headers appear.
The code looks like this:
Index.html - TD
<td id="despesa"><?php echo $dados['cod_despesa']; ?></td>
<td id="janeiro" data-toggle="modal" data-id="1" data-target="#modal_detalhes"><?php echo $dados['janeiro']; ?></td>
Div - Modal
<div id="dados" class="modal-body modal-xs"></div>
Script
function janeiro(despesa)
{
var page = "analitico.php";
$.ajax
({
type: 'POST',
dataType: 'html',
url: page,
beforeSend: function () {
$("#dados").html("Carregando...");
},
data: {despesa: despesa},
success: function (msg)
{
$("#dados").html(msg);
}
});
}
$('#janeiro').click(function () {
janeiro($("#despesa").val())
});
Analitico.php
$sql_detalhe_janeiro = "select.."; $detalhe_fevereiro = mssql_query($sql_detalhe_fevereiro);
Modal table
<?php
while($dados = mssql_fetch_assoc($detalhe_janeiro)) {?>
<tr>
<td><?php echo $dados['DESCRICAO']; ?></td>