Synchronous XMLHttpRequest on the main thread is deprecated...
Synchronous XMLHttpRequest on the main thread is deprecated...
hello, I'm new to using datatable and I really like it, it's very usefull, and I got it working on a standar page, but I'm developing a system where I use Materialize and want to show the table with the Jquery style in a div, I make have a js function that calls my .php page into that div, and the .php page have the table with the ID, and it's suposed to show all the data (I try running the table as a normal page, not in the div, and it shows the data just fine) but it explodes and says this error in the firebug console, the Json is right and all but I don't know why this error shows up, I'm new to javascript,ajax and stuff, those are my functions:
the first two are obviously inside a "$(document).ready(function(){":
the one that calls the page into the div:
$("#retiros").on('click', function() {
var url = $(this).attr('data-url');
carga(url);
$("#imagen").attr("src","../img/retiro.jpg");
$('#nombre').html('RETIROS ACADÉMICOS');
})
the datatable one:
var datatable = $('#mytable').DataTable({
ajax: "../prueba.php",
"sAjaxDataProp": "",
"bProcessing": true,
columns:
[
{data:"cedula"},
{data:"numero"},
{data:"razon"},
{data:"link"}
]
});
and retiros .php would be:
<html>
<head>
<script src="../js/init.js"></script>
</head>
<body>
<table id="mytable" class="display" style="text-align:center" cellspacing="0" width="100%">
<thead>
<tr>
<th>cedula</th>
<th>numero</th>
<th>razon</th>
<th>accion</th>
</tr>
</thead>
<tfoot>
<tr>
<th>cedula</th>
<th>numero</th>
<th>razon</th>
<th>accion</th>
</tr>
</tfoot>
</table>
</body>
</html>
If someone knows why this happens :) It'll be cool if you help me out! >.<
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
Answers
Can you provide a link to the page showing the issue please (per the forum rules). The code shown above wouldn't make a synchronous request, unless there is something else going on.
Allan
I already solved the problem, I'm using a local server to make it work, and the problem was the ajax call :D I fixed it using:
$(document).ready(function(){
var datatable = $('#mytable').DataTable({
"ajax": {
"url": "../procesos/motor_funciones.php",
"type": "POST",
"data" : {
"accion" : "mostrar_proceso_ret", //nombre que recibe el switch
}
},
"sAjaxDataProp": "",
"processing": true,
// "serverSide": true,
columns:
[
{data:"cedula"},
{data:"numero"},
{data:"razon"},
{data:"link"}
]
however I have another problem, I can't seem to make the "show entries" select to work, and I don't know how to make it :/
https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-xlt1/v/t35.0-12/12499210_10207928697992730_1243349481_o.jpg?oh=b6bec4197af622c670d9d18cbf82e56a&oe=568E8511&__gda__=1452195433_387a56c2922d5b563aa67332517554ff
that's a picture of the table, as you can see, the "show entries" select does not work, and I've tryed putting options such as:
*- "sPaginationType": "full_numbers",
*- "iDisplayLength" : 10,
and nothing u.u
Sorry - without a link to a page showing the issue I can't offer any help.
Allan
oh well, no problem :) I'll figure it out by myself, ty anyways