I have a XML response from an Ajax REST call. Similar to the one below.
<eventBlock>
<event eventId="641">
<processId>myprocess</processId>
<batchId>15581</batchId>
<user>Ajay</user>
<participant>XYZ</participant>
<activity>Jogging</activity>
<note>Athletic</note>
<createdOn>2011-11-22 00:00:00.0</createdOn>
<createdBy>User5</createdBy>
</event>
</eventBlock>
My HTML:
<form class="searchform" id="searchform" action="javascript: submitForm();">
.....
</form>
<div id="UI">
<table id="events" class="display">
<thead>
<tr>
<th>eventId</th>
<th>processId</th>
<th>batchId</th>
<th>user</th>
<th>participant</th>
<th>activity</th>
<th>note</th>
<th>createdOn</th>
<th>createdBy</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
Javascript:
<script type="text/javascript">
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;
}
</script>
When I hit the submit. I get below error on firebug. Can someone help me resolve this?
oSettings is null [Break On This Error]
var iRow = oSettings.aoData.length;
Thanks in advance!