I have two files basic.php
and pptimeline.php
. The purpose here is to select a value from a combobox in basic.php
, process it in the pptimeline.php
and print it back in basic.php
. But I'm not having success in doing so. If anyone can help I appreciate.
EDIT: The pptimeline.php
file acts as a json file header('Content-Type: application/json');
. It has only querys which I then echo in the file but are not relevant here since everything works if I use default values instead of $nprocess
in the query. The code that displays my data is inside the sucess:
parameter in basic.php
. If I remove what is around it everything works fine, but then it doen'st change based on what I choose.
Basic.php
<label for="Process"> NProcess : </label>
<select id="cproc">
<?php
foreach ($products as $res3)
{echo "<option value='".$res3["PROCESSO"]."'>".$res3["PROCESSO"]."</option>";}
?>
</select>
<script type='text/javascript'>
$("#cproc").on("change", function(){
var v1 = $(this).val();
$.ajax({
url: "pptimeline.php",
type: "POST",
data: {'value' : v1},
success: function(response){
/**DISPLAY DATA IN INTERFACE**/
var tg1 = {};
$(function () {
// jQuery widget implementation
// with some basic options
tg1 = $("#placement").timeline({
"min_zoom":1,
"max_zoom":55,
"image_lane_height":100,
"icon_folder":"timeglider/icons/",
"data_source":"pptimeline.php",
"constrain_to_data": false
});
tg_actor = tg1.data("timeline");
// You'll use tg_actor as the key to access
// public API methods like "goTo", etc.
}); // end document-ready
/****/
}, error: function(x,y,z){
alert("error"); } }); });
</script>
pptimeline.php
if (isset ($_POST['value'])) {
$nprocesso = $_POST['value'];
$query1 = "SELECT TO_CHAR(DATACRIACAO,'YYYY-MM-DD') AS DATACRIACAO, NPROCESSO,
BLOCOOPERATORIO, TIPOINTERNAMENTO, TIPOINTERNAMENTOCIRURGIA, GLASGOW_HOSPITAL
FROM PATIENT_TIMELINE_ADMISSAO WHERE NPROCESSO =".$nprocesso."";
}