title: How wait to AJAX response
body: <p>i wanna know how i can make a pause in the system to wait the answer from the server in an AJAX request?</p>
  
  <pre><code>var method = childs[cont].getAttribute('method');
              var address = childs[cont].getAttribute('address');
              /*
               * Making the AJAX connection 
               * and returning the results.
               */
              phone = new ConstructorXMLHttpRequest();
              onreadystatechange = function(){
                  switch(phone.readyState){
                      case 0: if(phone.readyState == 0){
                          break;
                      }
                      case 1: if(phone.readyState == 1){
                          break;
                      }
                      case 2: if(phone.readyState == 2){
                          break;
                      }
                      case 3: if(phone.readyState == 3){
                          break;
                      }
                      case 4: if(phone.readyState == 4){
                          if(phone.status == 200){
                              var val = phone.responseText; 
                              alert([val,1]);
                              dataInsert(val);
                              break;
                          }
                          else{
                              alert("Problemas status:"+phone.status+" state:"+phone.readyState);
                              break;
                          }
                      }
                  }
              };
              phone.onreadystatechange = onreadystatechange;
              if (method == 'POST'){
                  phone.open(method, address, true);
                  phone.setRequestHeader("Content-type", "multipart/form-data");
                  phone.send(xml2string(prepCall(childs[cont])));
              }else if(method == 'GET'){
                  phone.open(method, address, true);
                  phone.setRequestHeader("Content-type", "multipart/form-data");
              }
  </code></pre>