I don't know what is the problem.
I have this part of my php:
public function fillObject(){
try {
$servername = "localhost";
$username = "root";
$password = "123asd";
$conn = new PDO("mysql:host=$servername;dbname=bd_actividades", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT pro_nombre FROM act_proyecto");
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$result = $stmt->fetchAll();
foreach ($result as $row) {
$aObjects=array();
$oTransfer = new TransferProyeCtr();
$oTransfer->setNombre($row['pro_nombre']);
$oTransfer->setState(1);
$aObjects[]=$oTransfer;
return $aObjects;
} }catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
} }
this send the results : $oTransfer->setNombre($row['pro_nombre']);
And in my dropdown show this:
But I need this :
What is the problem? Here is my module where I print:
Ajax:
llenarComboProyectos: function(iSecciones){
var self = this;
self.ajaxCall('http://localhost:8080/PROJECTS/dailytasks/api/sistemaTareas/v1/'+"proyectos","GET", null).then(function(data) {
console.info("data",data);
if(self.checkError(data[0].state)){
self.llenarCombos(iSecciones,data);
}else{
alert("error service");
}
});
},
Where I print:
llenarCombos: function(secciones,data){
var self = this;
console.info(data);
for (var i = 0; i < data.length; i++){
var cProyectos = "<option>"+data[i].nombre_proyecto+"</option>";
for(var iCont=0;secciones>=iCont; iCont++){
$("#select_proyecto_"+iCont+"_id").append(cProyectos);
$("#select_proyecto_"+iCont+"_id").selectpicker('refresh');
}
}
},
here I get pro_nombre: var cProyectos = "<option>"+data[i].nombre_proyecto+"</option>";