title: How can I make sure that other functions is run after this get function is fully completed and rendered?
body: <p>I have this script that adds elements with data by a get json function.</p>
  
  <pre><code> $(document).ready(function() {
          ADD.Listitem.get();
          });
  </code></pre>
  
  <p>It basicly adds a bunch of html tags with data etc. The problem I have is following:</p>
  
  <pre><code> $(document).ready(function() {
      ADD.Listitem.get();
  
      var arr = [];
      $(".Listitem-section-item-title").each(function() {
          arr.push($(this.text()));
      });
   });
  </code></pre>
  
  <p>-</p>
  
  <pre><code>get: function(web) {
              AST.Utils.JSON.get("/_vti_bin/AST/ListItem/ListitemService.svc/GetListItem", null, AST.Listitem.renderListitem);
          },
  renderListitem: function(data) {
              $("#Listitem-template").tmpl(data["ListItemResults"]).prependTo(".ListItem-section-template");
      }
  </code></pre>
  
  <p>and here is the json get:</p>
  
  <pre><code>ADD.Utils.JSON.get = function (url, data, onSuccess) {
      $.ajax({
          type: "GET",
          contentType: "application/json; charset=utf-8",
          async: true,
          url: url,
          data: data,
          cache: false,
          dataType: "json",
          success: onSuccess,
          error: ADD.Utils.JSON.error,
          converters: { "text json": ADD.Utils.JSON.deserialize }
      });
  }
  </code></pre>
  
  <p>The array each loop is not running beacuse  the get method is not finished with rendering the <code>Listitem-section-item-title</code> selector so it cant find the selector.</p>
  
  <p>Is there any good solutions for this?</p>