0
I need a drug IVD to be filled in the moment the user chooses one of the options in a combobox (subtype).
In my index I have the combobox, where I created the Ajax script as below:
$('#subtipo').change( // o subtipo está localizado nesta página.
function() {
$.ajax({
type: "GET",
url: "AJAX_buscaMedicamentos.php?id="+id, //aqui faço os "selects" dos medicamenos
success: function(data) {
// Preciso dizer que a div a ser preenchida de ID "box_medicamentos" está em outra pagina, nomeada medicamentos.php.
}
});
}
);
Now the table to be filled nay this in my index, is on another page called medicamentos.php
(this page appears in my index using the JS
TabbedPanelsTab
).
On the page medicamentos.php
the DIV must be completed as below:
echo '<div class="tbline titlecel"><div class="tbcel1"></div><div class="tbcel3">Medicamento</div><div class="tbcel2">Via Administração</div><div class="tbcel2">Dose</div><div class="tbcel2">Unid. Medida</div><div class="tbcel3">Dias Aplicação</div><div class="tbcel3">Ciclos Aplicação</div><div class="tbcel3">Diluente/Reconstituinte</div><div class="tbcel2">Dose</div><div class="tbcel2">Unid. Medida</div></div>';
while (($exibe = oci_fetch_array($parsed_medicamento, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
$NR_SEQUENCIA = $exibe ["NR_SEQUENCIA"];
$DS_MATERIAL = $exibe ["DS_MATERIAL"];
$DS_VIA_APLICACAO = $exibe ["DS_VIA_APLICACAO"];
$QT_DOSE = $exibe ["QT_DOSE"];
$DS_UNIDADE_MEDIDA = $exibe ["DS_UNIDADE_MEDIDA"];
$DS_DIAS_APLICACAO = $exibe ["DS_DIAS_APLICACAO"];
$DS_CICLOS_APLICACAO = $exibe ["DS_CICLOS_APLICACAO"];
$DS_DILUENTE = $exibe ["DS_DILUENTE"];
$QT_DOSE_DILUENTE = $exibe ["QT_DOSE_DILUENTE"];
$DS_UNID_MEDIDA_DILUENTE = $exibe ["DS_UNID_MEDIDA_DILUENTE"];
echo '<div class="tbline"><div class="tbcel1 excluir"><a href="?exclui=ok&id='.$idsession.'&nr_sequencia='.$NR_SEQUENCIA.'"><font color="#FFFFFF">excluir</font></a></div><div class="tbcel3">'.$DS_MATERIAL.'</div><div class="tbcel2">'.$DS_VIA_APLICACAO.'</div><div class="tbcel2">'.$QT_DOSE.'</div><div class="tbcel2">'.$DS_UNIDADE_MEDIDA.'</div><div class="tbcel3">'.$DS_DIAS_APLICACAO.'</div><div class="tbcel3">'.$DS_CICLOS_APLICACAO.'</div><div class="tbcel3">'.$DS_DILUENTE.'</div><div class="tbcel2">'.$QT_DOSE_DILUENTE.'</div><div class="tbcel2">'.$DS_UNID_MEDIDA_DILUENTE.'</div></div>';
}
Since I do the selects on the page AJAX_buscaMedicamentos.php?id=XX
how do I get the page DIV medicamentos.php
be filled?
Note: The DIV is on another page
medicamentos.php
, because this is the page where the user will review the medicines that will appear.
From what I see
data
is a string with HTML right? In this case$('#id-da-div').html(data);
do what you want. you’ve tried it?– Sergio
But as I said, the DIV is on another page (medicamentos.php), and the script is on my home where has the combo #subtipo where the user makes the choice and as the choice should be filled the DIV in medicines.php
– Felipe Moura Shurrab