I created a simple static web project in Eclipse. I downloaded jquery.js and jquery.dataTables.js into my WebContent folder. Then I created a index.html page which looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable({
"sAjaxSource" : 'http://localhost:8080/myProj/listLogs?messageId=33333333333'
});
});
</script>
<title>Insert title here</title>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" class="display"
id="example">
<thead>
<tr>
<th>stuff</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th>stuff</th>
</tr>
</tfoot>
</table>
</body>
</html>
The JSON response from http://localhost:8080/myProj/listLogs?messageId=33333333333 should look like:
{
"aaData": [
[
"This is a NEW message"
],
[
"Parsing message with messageId = 33333333333 and eventType = CREATE"
],
[
"Start running workflow with 4 actions"
],
[
"Updating entitlement for event: [33333333333:CREATE]"
],
... }
But when I open the index.html in my firefox, nothing gets loaded. I do see this on the page though:
stuff
stuff
Loading...
Showing 0 to 0 of 0 entries
PreviousNext
My JSON URL was not even invoked. Not sure why.
$(document).ready(function() {
. Just simplly enclose onload code in:$(function(){ //code goes here });