I have a big question, today I am consuming data from a web services as always, using angularJS and I have a new problem:
I consume a web services that in response gives me the following:
{success: "true", n_sucursales: 2, id_sucursal: "19", id_servicio: "38,39",…}
activo_modulos:"1,1"
id_modulos:"18,52"
id_servicio:"38,39"
id_sucursal:"19"
n_modulos:2
n_sucursales: 2
nombre_modulos: "1 - Farmacia Preferencial,2 - Farmacia Preferencial"
nombre_servicio: "NORMAL,PREFERENCIAL"
nombre_sucursal:"Hospital Sótero"
success:"true"
If you realize there are variables that bring me two data, in this case I focus on ID_SERVICIO
because I have to send that data to another web services.
How I send them: first I configure url, method, etc. in a service and then the data obtained I save it in a variable and finally I send it that way (I would like to make only one request):
//consume los datos de id_servicio 38 [NORMAL]
Conection.Colaservices({
id_servicio: SaveCredentials.getData().id_servicio.split(',')[0]
},
function(response) {
console.log('normal', JSON.stringify(response.data));
$scope.normal = response.data;
});
//consume los datos de id_servicio 39 [PREFERENCIAL]
Conection.Colaservices({
id_servicio: SaveCredentials.getData().id_servicio.split(',')[1]
},
function(response) {
console.log(JSON.stringify(response.data));
$scope.preferencial = response.data;
});
Resulting in:
//NORMAL : 38
{success: "true",…}
data:
{id_servicio: "38", personas_esperando: "1", personas_atendidas: "706", tiempo_espera: "0",…}
id_servicio:"38"
id_ticket:"0"
letra:"-"
numero:"0"
personas_atendidas:"706"
personas_esperando:"1"
rut:"-"
tiempo_espera:"0"
success:"true"
//PREFERENCIAL: 39
{success: "true",…}
data:
{id_servicio: "39", personas_esperando: "0", personas_atendidas: "208", tiempo_espera: "0",…}
id_servicio:"39"
id_ticket:"0"
letra:"-"
numero:"0"
personas_atendidas:"208"
personas_esperando:"0"
rut:"-"tiempo_espera:"0"
success:"true"
Question:
How to add personas_atendidas
: "706" of NORMAL
with people_aids: "208" of PREFERENCIAL
(ie show 914)?