I am new to php,jquery and json. I am using all of it in my new website. My problem is i need to divide my html page into 4 parts as divs(north,south,east,west) and display a pie chart in each div, drawn from a jquery/javascript. I have added a foreach loop for each zone like north,south,east,west. and i have set the data needed by jquery/php script in session.
But i see that script executes only at the end of for loop and draws the pie chart only in the fourth div.
I want to know the syntax of how i can invoke the script for every iteration of the php loop. Request your help.
<?php
$customerSelected = "IBL";//change this to actual selected customer
$zoneArray = array(1,2,3,4);
$_SESSION['customerSelected']=$customerSelected;
foreach($zoneArray as $zone){
$_SESSION['zone']=$zone;
$quadrantName = '';
if($zone == 1){
$quadrantName = 'firstQuadrantNorth';
}else if($zone == 2){
$quadrantName = 'secondQuadrantSouth';
}else if($zone == 3){
$quadrantName = 'thirdQuadrantEast';
}else if($zone == 4){
$quadrantName = 'fouthQuadrantWest';
}
$_SESSION['quadrant']=$quadrantName;
?>
<div id="<?=$zone?>" style="height:250px;width:49.7%;float:left; border:1px solid #CCC;">
<div id="<?=$quadrantName?>" style="min-width:50%; height:100px;text-align:left"></div>
<script src="scripts/piechartsims.js?v=<?=$cachebuster; ?>"></script>
<div style="min-width:50%;height:140px;text-align:center;align:center;overflow:auto;">
<?php
include('LastCommunicatedInc.php');
?>
</div>
</div>
<?php
}
?>
`