Hello good morning I have a project with Ionic 1
where I have to make different queries and many requests in a single click (when synchronizing)
where I get a list of people first and the result I get
I am consulted all your data and at the same time sent all your information
for(var i=0; i<resutl.length; i++){
send(resutl, id_con_person);
//aqui llamo a la funcion send que a la vez esta funcion llama otras
funciones
}
How can I do it synchronously with angle 1 or what is the correct way to do this procedure? I would really appreciate it, greetings.
function send(resutl, id_con_person){
query="SELECT * FROM identification where id_con_person=?";
$cordovaSQLite.execute(db,query,[this_idPerson]).then(
var req = {method: 'POST',url: base_url_services,
data:$httpParamSerializer({xxxx.stringify(xxx)}),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}
$http(req).success(function(data, status, headers, config)
{
if(data[0].status==="SUCCESS"){
insertXXX(data[0].xxx)
insertXXX(data[0].xxxx);
}else{}
}).
error(function(data, status, headers, config)
{
alert("Error");
});introducir el código aquí
}
,function(error){
alert(JSON.stringify(error));
});
}
function insertXXX(){
query="SELECT * FROM xxxx ";
$cordovaSQLite.execute(db,query,[]).then(
var req = {method: 'POST',url: base_url_services,
data:$httpParamSerializer({xxxx.stringify(xxx)}),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}
$http(req).success(function(data, status, headers, config)
{
if(data[0].status==="SUCCESS"){
}else{}
}).
error(function(data, status, headers, config)
{
alert("Error");
});introducir el código aquí
}
,function(error){
alert(JSON.stringify(error));
});
}