I fetched data dynamically from from MySQL using a drop down menu through Ajax which was successful but when I echo the array values, instead of giving me the list of emails it was showing just symbols.
Take a look at the image below:
From the Email List, those are the symbols that were echo out.
here is my php code
if(isset($_POST["confirm_no"])){
$d = $_POST['confirm_no'];
$query = mysqli_query($mysqli, "select * from jobseeker WHERE confirm_no LIKE '$d%'");
//Display list
if(mysqli_num_rows($query) > 0){
$row = mysqli_fetch_array($query);
foreach ($row as $r) {
$emailArr[] = $r["mails"];
}
$emails = implode(";", $emailArr);
echo $emails;
}else{
echo 'No email for this selection.';
}
}
And the jQuery
$(document).ready(function(){
$('#smode').change(function(){
var confirm_no = $(this).val();
$.ajax({
type:'POST',
data:"confirm_no="+confirm_no,
url:'get_email.php',
success:function(data){
$('#emaillist').val(data);
}
});
});
});
Why is it echoing out this symbols?