in reply to Re^6: Server-side processing?
in thread Server-side processing?
{"748847":"Jane Deo"}
Did you look at any of the DataTables examples? Consider the following:
use DBI; use JSON::XS; 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 $json; $json->{data} = $dbh->selectall_arrayref('SELECT idnum, fname FROM dbu +ser', {Slice => {}} ); warn encode_json( $json );
print "Content-type: text/html\n\n";
JSON isn't html: application/json, and why are you manually printing headers when you're using CGI which has a method for that?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^8: Server-side processing?
by hippo (Bishop) on Feb 15, 2024 at 11:59 UTC | |
by marto (Cardinal) on Feb 15, 2024 at 12:18 UTC | |
Re^8: Server-side processing?
by frank1 (Scribe) on Feb 15, 2024 at 12:32 UTC | |
by marto (Cardinal) on Feb 15, 2024 at 12:50 UTC |
In Section
Seekers of Perl Wisdom