Data Table loading loading on server side

0

I have a project and I'm using data table, for its creation I made a code and it was working with test releases, when I exported a database backup the page took a long time to load the script and when I loaded it gave this error,

A script on this page may be running or has stopped responding. You can stop it now and open it in a debugger or wait for the script to finish.

Script: /dt/assests/datatables/datatables.min.js:36

When I click on continue the table loads, but until it appears this takes about 2 minutes.

**JS**


 $(document).ready(function() {
    manageMemberTable = $("#manageMemberTable").DataTable({
        "ajax": "php_action/retrieve.php",
        "language": {

            "url": "custom/datatables.pt-br.txt"

        },
        destroy: true,
    "autoWidth": false,
    "paging":   true,
    "ordering": true,
    "order": [[ 3, "desc" ], [ 0, "desc" ]],
        "info":     true,
        "dataType": 'json',
   });

php

<?php 

require_once 'db_connect.php';

$output = array('data' => array());

$sql = "SELECT * FROM tbl_cadastro";
$query = sqlsrv_query( $connect, $sql );

//$x = 1;
while( $row = sqlsrv_fetch_array( $query, SQLSRV_FETCH_ASSOC) ) {
    //$active = '';
    //if($row['active'] == 1) {
    //  $active = '<label class="label label-success">Active</label>';
    //} else {
    //  $active = '<label class="label label-danger">Deactive</label>'; 
    //}

    $actionButton = '
    <div class="btn-group">
    <div align="center">
      <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        Editar <span class="caret"></span>
      </button>
      <ul class="dropdown-menu">
        <li><a type="button" data-toggle="modal" data-target="#editMemberModal" onclick="editMember('.$row['ID'].')"> <span class="glyphicon glyphicon-edit"></span> Editar</a></li>
        <li><a type="button" data-toggle="modal" data-target="#removeMemberModal" onclick="removeMember('.$row['ID'].')"> <span class="glyphicon glyphicon-trash"></span> Remover</a></li>      
      </ul>
    </div>
        ';

    $output['data'][] = array(
        //$x,
        $row['SUBCONTA'],
        $row['PRODUTO'],
        $row['MES_ANT'],
        $row['MES_ATUAL'],
        $row['VARIACAO'],
        $row['JUST'],
        $row['RESP'],
        $actionButton
    );

    //$x++;
}

// database connection close
//$connect->close();
sqlsrv_free_stmt($connect);
echo json_encode($output);
    
asked by anonymous 06.11.2018 / 18:16

0 answers