Uncaught TypeError: Object [object Object] has no method 'api'
Uncaught TypeError: Object [object Object] has no method 'api'
Sangeetha C G
Posts: 5Questions: 2Answers: 0
$(document).ready(function(){
var table1=$('.MessagingTable').DataTable({
});
setInterval( function () {
table1.api().ajax.reload();
}, 10000 );
});
The above reload says has no method 'api' can you please advice?
This discussion has been closed.
Answers
There is no
api()
method on the return from$().DataTable().
Just usetable1.ajax.reload()
.Allan
i even tried that , but it throws "Uncaught TypeError: Cannot call method 'reload' of undefined" in console
In which case, per the forum rules, could you link to the page so I can debug the issue please.
Allan
sure thing. but unfortunately the code is in my workspace set up.
below is the code :
i had used to create the table using datatable:
<scriptsrc="http://localhost:8080/js/jquery.dataTables.min.js"type="text/javascript"></script>
<table name="Row_Table" id="Row_table" class="bannerTable" style="border: none">
<thead style="border: none">
<th name="1">
</th>
<th name="2">
</th>
</thead>
<tbody>
<tr>
<td name="IS_ACKNOWLEDGED_ColumnData" class="tableCellList">
</td>
<td >
<a id="bannerLink"><%=((Bean) (Bean.get(i))).getSubject()%></a>
</td>
</tr>
</tbody>
</table>
$(document).ready(function(){
var table1=$('.bannerTable').DataTable({
});
setInterval( function () {
console.log("table===="+table1);
//table1.ajax.reload();
table1.api().ajax.reload();
// table1.api().ajax.reload();
}, 10000 );
});
i need to load this var table1=$('.bannerTable') for every 1 minute and do the server side call to fetch the new data from server side.
sure thing. but unfortunately the code is in my workspace set up.
below is the code :
i had used to create the table using datatable:
table1.ajax.reload();
- that option should work.If it doesn't, as I say, we would need a link to the page.
Allan