Error when executing..

Error when executing..

SynapseUserSynapseUser Posts: 11Questions: 3Answers: 0

Hi I recently posted in the "free forum" about an issue I am having with Datatables. I then decided to purchase a license and hoped that it may give me access to the priority support ? If I am wrong - then forgive me = not sure how the system works.

Anyway, here is a link to my original post. If you want me to re-post t here in full I can :smile:

https://datatables.net/forums/discussion/52819/no-data-displayed-just-says-processing/p1?new=1

Thanks.

Answers

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    I assume you mean you have purchased a licence for the DT Editor.
    If so, then A. priority support is an entirely separate issue, and B. according to your HTML code you are not actually using the Editor.
    You need to supply more information. How are you initialising DataTables? How are you calling your PHP file?

  • SynapseUserSynapseUser Posts: 11Questions: 3Answers: 0

    I clicked the link that implied it was for datatables here : https://datatables.net/purchase/index

    No, I am not using the editor, just working from the examples posted. Here is the situation ..

    1. I have a PhP script that returns valid json data from a database.
    2. I would like to call this script and populate a datatables table with the resulting data

    So I am unsure how to call datatables, I have tried several ways - but none will work with my existing PhP file.

    Here is my last attempt ..

    The HTML file
    //=============================================================
    <!DOCTYPE html>

        <html>
            <head>
                <title></title>
                <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
                <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"> 
            </head>
            <body>
                <table id="example" class="display" style="width:100%">
                <thead>
                    <tr>
                        <th>Device ID</th>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                        <th>DEVICEID</th>
                    </tr>
                </tfoot>
            </table>
                <script> 
                   $(document).ready(function() {
           $('#example').DataTable( {
            serverSide: true,
            ajax: '/../mobile/admin/get_dev_list.php?deviceid=ALAN'
        } );
        } ); 
                </script>
            </body>
        </html>
        //=============================================================
    

    Here is the output from my PhP file

    [{"DEVICEID":"ALAN"},{"DEVICEID":"BOB"}]

    Here is what I do know..

    1. The url I am using in the "ajax" parameter is valid (as in the path is correct)
    2. The data returned from the PhP file is valid json data

    I can only imagine that the way I am calling / configuring datatables is not correct.

    Thanks for response,,

  • SynapseUserSynapseUser Posts: 11Questions: 3Answers: 0

    For completeness - here is the actual PhP script I am using ..

    <?php
    
    
    define('__ROOT__', dirname(dirname(__FILE__)));
    require_once(__ROOT__.'\lib\utils.php'); 
    require_once(__ROOT__.'\debug_mob_config.php'); 
    
    if (isset($_GET["deviceid"])) 
    {
        get_devices($DB);
    }
     else {
    
    }
    
    
    function get_devices($DB)
    {
    $stmt = $DB->prepare("SELECT DISTINCT(DEVICEID) DEVICEID FROM DEL_STATUS");
    
    $stmt->execute();
     $result = $stmt->fetchAll();
    
    echo json_encode($result);
    }
    
  • SynapseUserSynapseUser Posts: 11Questions: 3Answers: 0

    Its ok, I figure it out - thanks :smile:

This discussion has been closed.