Estoy haciendo llamados a mi Bd de datos que tengo almacenados, dichos datos poseen tildes, eñes, entre otros caracteres especiales, lo cual me genera en consola al ejecutar mi script esto.
HTML:
<label class="form-label" for="Ips">IPS</label>
<Select type="text" class="form-control form-control-lg" name="Ips" id="Ips" >
</Select>
JS:
function cargar_ips(){
$.ajax({
url: '../config/callips.php',
type: 'GET',
success: function(response){
let diagnosis = JSON.parse(response);
let template = '';
diagnosis.forEach(diagnosis => {
template += `
<option value=${diagnosis.KP_UUID}>${diagnosis.Codigo}</option>
`
});
$('#Ips').html(template);
}
});
}
$(document).ready(cargar_ips);
php:
<?php
// header("Content-Type: text/html; charset=iso-8859-1");
include 'config.php';
$sql = "SELECT PK_UUID,Name0,Nit FROM entities WHERE FK_Type = '959df8c4-1a40-11ed-8aff-846993530662' ORDER BY Name0";
$result = mysqli_query($conn,$sql);
$count = mysqli_num_rows($result);
if(!$result){
die('Query Error'. mysqli_error($conn));
}
if ($count>0){
$json = array();
while($row = mysqli_fetch_array($result)) {
$json[] = array (
'pk_uuid' => $row['PK_UUID'],
'name' => $row['Name0'],
'nit' => $row['Nit']
);
}
$jsonstring = json_encode($json);
echo $jsonstring;
}
else{
$result = "No hay resultados";
}
?>