Greetings to all, I have the following JavaScript code:
var Lista=[];
$.getJSON("php/consultas/TraerDatos.php", function( data ) {
$.each(data, function(id,value){
var elemento = {
'Proyecto':''+value['Proyecto'] +'',
'Motivo':''+value['Motivo']+'' ,
'Codigo': ''+value['Codigo']+'' ,
'otro': ''+value['Motivo']+'' ,
'Lugar': ''+value['Lugar']+''
};
Lista.push(elemento);
});
});
And I need to take the value 'Code' from the array 'List' to assign it to another variable
var temp = /* Asignación que no tengo clara hacer del objeto del array
Lista de su valor 'codigo' en la posición 0 */
only that value, so I guess I do not need to go through it with foreach, in the context of my function all these elements have the same value in the code, I would get it from this array in position 0, I have tried but not me works. What is the correct way to obtain this value in this case?
As always I am open to your suggestions and advice. Thanks for your time.