This is what i tried, and still not working. it just hangs on Processing...

i first made sure that i get well structured json

#!/usr/bin/perl -wT use strict; use warnings; use DBI; use JSON; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); my $host = "host"; my $usr = "user"; my $pwd = "pwd"; my $dbname = "datname"; my $dbh = DBI->connect("DBI:mysql:$dbname:$host", $usr, $pwd, { RaiseError => 1, }) or die $DBI::errstr; my $Test = $dbh->prepare("SELECT idnum, fname FROM dbuser"); $Test->execute(); my (@data,$idnum,$fname); foreach (@data = $Test->fetchrow_array()) { $idnum = $data[0]; $fname = $data[1]; } print "Content-type: text/html\n\n"; my $json = encode_json( { $idnum, $fname} ); print $json;

OUTPUT IS

{"748847":"Jane Deo"}

And this is my html

<!doctype html> <html> <head> <meta charset="UTF-8"> <title></title> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.ne +t/v/bs-3.3.7/jq-3.3.1/dt-1.10.18/datatables.min.css"/> <script type="text/javascript" src="https://cdn.datatables.net/v/bs/jq +-3.3.1/dt-1.10.18/datatables.min.js"></script> <script type="text/javascript" src="https://stackpath.bootstrapcdn.com +/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script> <script> jQuery(function($){ $("#table_id").DataTable({ "processing": true, "serverSide": true, "ajax": "file.pl" }); }); </script> </head> <body> <h1>sample dataTable</h1> <table id="table_id" class="table table-hover"> <thead> <tr> <th>ID</th> <th>NAME</th> </tr> </thead> <tbody> <tr> <td></td> <td></td> </tr> <tr> <td></td> <td></td> </tr> </tbody> </table> </body> </html>

In reply to Re^6: Server-side processing? by frank1
in thread Server-side processing? by frank1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.