title: How to append REST call JSON response to jQuery datatables?
body: <p>I'm trying to display the REST call JSON response in jQuery <a href="http://datatables.net" rel="nofollow">datatables</a>.</p>
  
  <p>Below is the JSON response I'm receiving.</p>
  
  <pre><code>{
      "artifact": [
          {
              "artifactId": "I8cc4a96ef69a11e08b448cf533780ea2",
              "batchId": "15581",
              "processId": "115458787"
          },
          {
              "artifactId": "e08b448cf533780ea2I8cc4a96ef69a11",
              "batchId": "14962",
              "processId": "787974254"
          }
      ]
  }
  </code></pre>
  
  <p>The Script:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          $(document).ready(function () {
              $("#artifacts").dataTable({
                  "sPaginationType": "full_numbers",
                  "bJQueryUI": true
              });
          });
          function submitForm()
          {
              $.getJSON('http://myurl.com/JerseySample/rest/search', function(data) {
                  $.each(data.artifact, function(i,artifact){
                          $('#artifacts').datatable().fnAddData([
                                  artifact.artifactId,
                                  artifact.batchId,
                                  artifact.processId ]
                                  );
                  });
               });
          }
  &lt;/script&gt;
  </code></pre>
  
  <p>The HTML:</p>
  
  <pre><code>&lt;form class="searchform"&gt;
          &lt;input class="searchfield" type="text" /&gt; 
          &lt;input class="searchbutton" type="button" value="Go" id="go" onclick="submitForm()" /&gt; 
  
  &lt;/form&gt;
      &lt;div id="container"&gt;
          &lt;div id="demo_jui"&gt;
              &lt;table id="artifacts" class="display"&gt;
                      &lt;thead&gt;
                              &lt;tr&gt;
                                  &lt;th&gt;Artifact Id&lt;/th&gt;
                                  &lt;th&gt;Batch Id&lt;/th&gt;
                                  &lt;th&gt;Legacy Id&lt;/th&gt;
                              &lt;/tr&gt;
                      &lt;/thead&gt;
                      &lt;tbody&gt;
                      &lt;/tbody&gt;
              &lt;/table&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Can someone provide an answer on why I am unable to load the JSON response into datatable? Is there a better approach to get this functionality?</p>