Wait JSON response inside a FOREACH

Wait JSON response inside a FOREACH

Hello,
I have a doubt regarding how to show JSON reponse inside a FOREACH, what is happening is that FOREACH is not waiting the necesary time to get the response form JSON.
I was searching some info. and I could find out that I can use queue or async.foreach but is not working for me (or maybe I'm not implementing it correctly)

The issue maybe could be because I'm using JSON inside a function (function getTotal(idProcess,day)).
 
[CODE]
function  getProcesos ( e ){
    
//Realizo un proceso de obtención de datos con JSON
        //Empiezo a recorrer los datos con el foreach
    
$. each jsonStr , function(  key val 
) {
             var 
spanProceso  document . createElement ( 'span'
);
          
spanProceso . style . fontSize  setLimitSize
;
     
spanLunes . appendChild ( document . createTextNode ( " " + getTotal ( val . ID , 1 )+ "/" + val . Nombres
));
        
td2 . appendChild ( spanProceso 
);
        }

function 
getTotal ( idProcess , day
){
                
//Realizo un proceos JSON y devuelvo el resultado en la sig. variable.
                
return 
getTotalUsers
             
[/CODE]
As you can see I have inside the FOREACH a JSON call that is in a FUNCTION but I don't know how send the action to FOREACH to wait for the JSON response.

Any Idea :S?
 
Thanks in advance!