Hey, I splited into three part: 1, the first is the route handler, AJAX backend, ... get '/' => sub { template 'rootTemplate', { } }; ajax '/getAll' => sub { my $allHashRef = HelperModule->fetchAll_hashref(); foreach ( keys %$trac) { push @_, { value => "$_", text => "$trac->{$_}", } } return to_json(\@_); return to_json(\@_); }; 2, data visualization: template toolkit, bootstrap, jquery, ... 3, data gathering in separated Perl module In the separated Perl modul I do all of the queries, updates, creation and returning the object, hashes, arrays, ... to the caller. In this way I can do more efficient testing and a code reusing for example in a Perl script. On Thu, Aug 20, 2015 at 4:17 AM, Richard Reina <gatorreina@gmail.com> wrote:
Have been learning Dancer2 over the last few weeks and really like it. Wondering if someone can tell me how I can load data from a MySQL database into a dancer rendered page. I am comfortable writing SQL in perl via perl->DBI just don't have any idea how to bring the data from a fetch into a webpage so that I can display it directly on the page or load it into a dropdown menu. Any help is greatly appreciated.
Thanks
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users