Basically I am trying to pass multiple columns from a mysql data base into multiple separate divs. Below is the ajax code I am using, I am not sure if that is the only information that is needed so if you need more feel free to let me know. I got it to pull the other columns however when the Jquery/ajax combination gets called it pulls all the information into all the divs.
I added the other IDs below the console log but ultimately it just added it to the same div like stated above. Any help on this would be greatly appreciated! In the mean time ill continue my search for an answer as well.
enter code here
//jquery
var ID=$(this).val();
if (ID){
//ajax call
$.ajax({
type:'POST',
url:'GetAllData.php',
data: 'Fullname='+ID,
success: function(html)
{
console.log(html)
$('#ID').html(html);
},
});
}else{
$('#ID').html('<value="">ID NOT LOADED</select>');
}
});
PHP
$Fullname=$_POST['Fullname'];
if(!empty($_POST['Fullname']))
{
$query=$conn->query("SELECT Supervisor, Fullname, ID, BalancedScore,
IncentiveMonth FROM SomeTable WHERE ID= '".$Fullname."'order by Fullname
ASC");
$rowCount=$query->num_rows;
if($rowCount>0)
{
while($row = mysqli_fetch_array($query))
{
$a = array ("ID[]" => $row['ID'], "BalancedScore[0]" =>
$row['BalancedScore'], "Fullname[1]" => $row['Fullname']);
print_r(array_values($a));
}
}else{
echo '<option value=""> Agent Value Not Available </option>';
}
}
HTML
<select name="agent" id="agent">
<option value="">Select Agent</option>
</select>
</div>
<div class="ID_Container">
<div name="ID" id="ID" >
ID
</div>
</div>
<div name="BalancedScore" id="BalancedScore" >
Balanced Score
</div>