Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to build datatable using jQuery from REST xml response?
    text
    copied!<p>I have a XML response from an Ajax REST call. Similar to the one below.</p> <pre><code> &lt;eventBlock&gt; &lt;event eventId="641"&gt; &lt;processId&gt;myprocess&lt;/processId&gt; &lt;batchId&gt;15581&lt;/batchId&gt; &lt;user&gt;Ajay&lt;/user&gt; &lt;participant&gt;XYZ&lt;/participant&gt; &lt;activity&gt;Jogging&lt;/activity&gt; &lt;note&gt;Athletic&lt;/note&gt; &lt;createdOn&gt;2011-11-22 00:00:00.0&lt;/createdOn&gt; &lt;createdBy&gt;User5&lt;/createdBy&gt; &lt;/event&gt; &lt;/eventBlock&gt; </code></pre> <p>My HTML:</p> <pre><code> &lt;form class="searchform" id="searchform" action="javascript: submitForm();"&gt; ..... &lt;/form&gt; &lt;div id="UI"&gt; &lt;table id="events" class="display"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;eventId&lt;/th&gt; &lt;th&gt;processId&lt;/th&gt; &lt;th&gt;batchId&lt;/th&gt; &lt;th&gt;user&lt;/th&gt; &lt;th&gt;participant&lt;/th&gt; &lt;th&gt;activity&lt;/th&gt; &lt;th&gt;note&lt;/th&gt; &lt;th&gt;createdOn&lt;/th&gt; &lt;th&gt;createdBy&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>Javascript:</p> <pre><code>&lt;script type="text/javascript"&gt; var thisTable; thisTable = $("#events").dataTable( { "sPaginationType": "full_numbers", "bJQueryUI": true } ); function addToTable(response){ var $events = $(response).find("event"); $events.each(function(index, event){ var $event = $(event), addData = []; addData.push($event.attr("eventId")); addData.push($event.children("processId").text()); addData.push($event.children("batchId").text()); addData.push($event.children("user").text()); addData.push($event.children("participant").text()); addData.push($event.children("activity").text()); addData.push($event.children("note").text()); addData.push($event.children("createdOn").text()); addData.push($event.children("createdBy").text()); thisTable.fnAddData(addData); }); } function submitForm() { $.ajax({ url:'../../data.xml', data:{ batchId:1234, processId:afsfafgg }, type:"GET", success:addToTable }); return false; } &lt;/script&gt; </code></pre> <p>When I hit the submit. I get below error on firebug. Can someone help me resolve this?</p> <blockquote> <p>oSettings is null [Break On This Error]<br> var iRow = oSettings.aoData.length;</p> </blockquote> <p>Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload