Can't load json object, always showing "loading"
Can't load json object, always showing "loading"
SummerJ1745
Posts: 9Questions: 3Answers: 0
Hi, All,
I used example on the dataTable page
http://live.datatables.net/lomapoke/1/edit
however, it always showed "loading" and no data was loaded.
here is the code
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' href='https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css'>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src='https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js'></script>
<script type="text/javascript" src="https://www.datatables.net/media/js/site.js?_=9831ea28f2ee98e525c11ef017a71afa"></script>
<script type="text/javascript" src="https://www.datatables.net/media/js/dynamic.php?comments-page=examples%2Fdata_sources%2Fajax.html" async=""></script>
<script type="text/javascript" src="https://www.datatables.net/examples/resources/demo.js" async=""></script>
<meta charset=utf-8 />
<title>DataTables - JS Bin</title>
<style type="text/css" class="init">
body {
font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
margin: 0;
padding: 0;
color: #333;
background-color: #fff;
}
div.container {
min-width: 980px;
margin: 0 auto;
}
div.dataTables_processing { z-index: 1; }
</style>
<script type="text/javascript" class="init">
$(document).ready( function () {
alert('doc ready');
var table = $('#example').DataTable( {
ajax: 'http://live.datatables.net/ajax/arrays.txt',
processing: true
} );
$('#reload').click( function () {
table.ajax.reload();
} );
} );
</script>
</head>
<body>
<button id="reload">Reload</button>
<div class="container">
<table id="example" class="display" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>
</div>
</body>
</html>
This discussion has been closed.
Answers
Your example is working for me. Maybe a temporary system issue that has been resolved?
I tried on different browser just now, didn't work.
What browser(s) have you tried? Your example works for me (Firefox).
What example, what page?
I tried both Firefox and chrome. The example age
http://live.datatables.net/lomapoke/1/edit works for me. But if I copy the source code and put everything in the html above, it didn't work.
There is a problem in 1.10.9 datatables with row identification that might affect your problem. Download the nightly build at the download page to see if that is the issue. It solved my issue.
The latest download was Sept 1st, I tried both today and last night, not working either.
Event the downloaded example from DataTable 1.10.9. The example code provided was not working. not data got loaded into the table. DataTables-1.10.9/examples/data_sources/ajax.html
"But if I copy the source code and put everything in the html above, it didn't work."
Are you aware that the jQuery core changed for version 2.0.3 (I think) that prevented IE from reading local files? See https://forum.jquery.com/topic/jquery-2-0-3-and-ajax-local-files for details.
I was using jquery 1.11.3 and didn't use IE.
The example appears to work correctly for me as well - Chrome Mac.
If your local copy isn't working I would suggest taking a look at your browser's console to see if any errors are reported.
Allan