#!/usr/bin/perl -w # ajaxCheckbox.pl - a script to test Ajax functionality use strict; use CGI qw/:standard/; use CGI::Ajax; use DBI; # --- database authenication my $dbh = do 'db.inc'; my $query = q{ SELECT project.project_id, project.name, project.phase, prio.prio, HEX((255 - prio.prio)) AS hex, begun, tags FROM project JOIN prio ON (project.project_id = prio.project_id) WHERE completed < 1 ORDER BY prio.prio DESC LIMIT 3}; my $sth = $dbh->prepare($query); $sth->execute(); my $result = $dbh->selectall_arrayref($sth); my $cgi = new CGI; my $pjx = new CGI::Ajax( 'toStruck' => \&perl_func ); print $pjx->build_html( $cgi, \&Show_HTML); sub Show_HTML { use CGI qw/:standard/; my $html = < This is the lastest source version

Carrot Queue

Priority List  |   Add a listing  |  

Project listing

HEAD foreach my $row (@$result) { $html .= ""; $html .= "
" . @$row[1] . "

"; } # you can append stuff to the HTML this way $html .= ""; return $html; } sub perl_func { my $input=shift; # if onClick the change the style if ($input eq "ON") { $input=""; } else { $input =""; } }