title: How do I retrieve web service data and place it in an html table?
body: <p>Is there a way to retrieve the json array from a web service and store it in a variable?</p>
  
  <p>I have a table like this:</p>
  
  <pre><code>&lt;table id="myTable" border="1"&gt;&lt;/table&gt;
  </code></pre>
  
  <p>And I populate it like so:</p>
  
  <pre><code>// JSON array
  var myData = method to retrieve json data from web service
  
  // Builds the HTML Table out of myList json data from Ivy restful service.
  function buildHtmlTable() {
      var columns = addAllColumnHeaders(myData);
  
      for (var i = 0 ; i &lt; myData.length ; i++) {
          var row$ = $('&lt;tr/&gt;');
          for (var colIndex = 0 ; colIndex &lt; columns.length ; colIndex++) {
              var cellValue = myData[i][columns[colIndex]];
  
              if (cellValue == null) { cellValue = ""; }
              row$.append($('&lt;td/&gt;').html(cellValue));
          }
          $("#myTable").append(row$);
      }
  }
  
  function addAllColumnHeaders(myList) {
      var columnSet = [];
      var headerTr$ = $('&lt;tr/&gt;');
  
      for (var i = 0 ; i &lt; myData.length ; i++) {
          var rowHash = myData[i];
          for (var key in rowHash) {
              if ($.inArray(key, columnSet) == -1) {
                  columnSet.push(key);
                  headerTr$.append($('&lt;th/&gt;').html(key));
              }
          }
      }
      $("#myTable").append(headerTr$);
  
      return columnSet;
  }
  </code></pre>
  
  <p>I have used the code found <a href="http://jsfiddle.net/manishmmulani/7MRx6/" rel="nofollow">here</a>. In this example the array is directly in the Javascript but I want to retrieve my array from a web service. Is this possible?</p>