in reply to Re: cgi scripts running javascript and passing control back and forth
in thread How to allow a user to reorder rows from a database using a web form?
Currently, my script is outputting a big html table. After writing the header, the main loop looks like this:
foreach my $item (@$array_ref) { print Tr( { -align => 'LEFT', -valign => 'TOP', -width => '20%' }, [ td( [ $q->a( { href => ticket_link( $item->{id} ) }, "$item->{id}" ), "$item->{spocpri}", "$item->{priority}", "$item->{cfprojectname}", "$item->{subject}", name_from_email( $item->{requestors} ), date_only( $item->{created} ), date_only( $item->{requesteddue} ) ] ) ] ); }
Just to keep things simple, could we leave templating out of it for the moment?
How do I incorporate the sorttable code into this? Do I print the <style> and <script> sections from within my script after the header? I have not worked with javascript before at all and I don't understand how the perl and javascript work together. Does the javascript code get embedded in the perl script? I've seen some examples of this. Does the perl script load the javascript? Do the function definitions go into a separate file? How does the cgi script even know that JQuery-ui even exists?
Maybe I will understand more after reading the template documentation tonight that you pointed me to.
Thanks - I appreciate your help!
|
---|