title: How do I get the ExecuteQueryAsync to behave more synchronously?
body: <p>Aight..this Sharepoint using Javascript..I'm using Alerts to debug my Javascript that runs from a Content Editor Web Part; the script is in the Assets library .   </p>
  
  <p>I get it...the WHOLE POINT of "async" function calls is to not wait around for the call to finish....but I fear the actions in the ExecuteQueryAsync, upon which future actions rely, would not complete resulting in error.</p>
  
  <p>I'm quite certain that, because of my Alert IN &amp; Alert BACK firing "backwards" that i'm indeed getting my Asynchronous behaviour.   I tried "ExecuteQuery" without the "Async" part...THAT failed miserably.</p>
  
  <p>Somebody wanna gimme a shove in the right direction toward getting the activities in my ONSUCCESS function to finish before returning to the OBJ function?</p>
  
  <pre><code>function One()
  {
  alert("in ONE");
  OBJ();
  alert("back from Obj, in One Again");
  }
  
  function OBJ(){
  alert("in OBJ");
   var clientContext = null; 
   var currentweb = null; 
          clientContext = new SP.ClientContext.get_current(); 
          web = clientContext.get_web(); 
          var Questionlist = web.get_lists().getByTitle("Exam Objectives"); 
          var camlQuery = new SP.CamlQuery();
          var q = "";    //camlQuery text in q to limit colls returned, empty string returns all
          camlQuery.set_viewXml(q); 
          this.listItems = Questionlist.getItems(camlQuery); 
  
          clientContext.load(listItems);
           clientContext.executeQueryAsync(Function.createDelegate(this, this.onListItemsLoadSuccessObj), Function.createDelegate(this,         this.onQueryFailed)); 
   alert("leaving OBJ");    //THIS ALERT FIRES BEFORE THE ALERT BELOW********
   }
  
  function onListItemsLoadSuccessObj(sender, args) { 
   var listItemInfo = '';
   var oListItem = null;
  var listItemEnumerator = listItems.getEnumerator();
  
  while (listItemEnumerator.moveNext()) {
      oListItem = listItemEnumerator.get_current();
      listItemInfo += '\nID: ' + oListItem.get_id() + 
          '\nTitle: ' + oListItem.get_item('Title');
  }
  
  alert(listItemInfo.toString());  //THIS ALERT FIRES AFTER THE ALERT ABOVE*********     
  }
  </code></pre>