For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > November 2007 > Perl and JavaScript Issue









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Perl and JavaScript Issue
Steven Sim

2007-11-24, 7:00 pm

Gurus;

I have written a Perl CGI script to dynamically generate HTML and
Javascript code for a web page.

The web page consist of two parts.

The first part displays a list of directories.

The Javascript code that does this is dynamically generated by Perl. I
use Perl's opendir function to capture the directory elements into an
array and thus generate the JS script to display the user selectable
option from that array.

Easy enough.

The 2nd part is to display the list of files within the directory
selected in the first part. But at this stage, Perl has already competed
running. The entire page HTML and Javascript code has already been
displayed by Perl.

Question becomes how I can use Perl to get the Javascript answer in the
first part and use it to dynamically generate the Javascript code for
the 2nd part? (without using a 2nd page).

(I don't really know JS very well and I cannot find any "file listing"
function in JS. If it does have such, it will solve all my problems.)

Help?

Warmest Regards
Steven Sim




Fujitsu Asia Pte. Ltd.
________________________________________
_____________

This e-mail is confidential and may also be privileged. If you are not the intended recipient, please notify us immediately. You should not copy or use it for any purpose, nor disclose its contents to any other person.

Opinions, conclusions and other information in this message that do not relate to the official business of my firm shall be understood as neither given nor endorsed by it.


Nobull67@Gmail.Com

2007-11-24, 7:00 pm

On Nov 24, 4:03 pm, steven....@faplccc.net (Steven Sim) wrote:
> Gurus;
>
> I have written a Perl CGI script to dynamically generate HTML and
> Javascript code for a web page.
>
> The web page consist of two parts.
>
> The first part displays a list of directories.
>
> The Javascript code that does this is dynamically generated by Perl. I
> use Perl's opendir function to capture the directory elements into an
> array and thus generate the JS script to display the user selectable
> option from that array.
>
> Easy enough.
>
> The 2nd part is to display the list of files within the directory
> selected in the first part. But at this stage, Perl has already competed
> running. The entire page HTML and Javascript code has already been
> displayed by Perl.
>
> Question becomes how I can use Perl to get the Javascript answer in the
> first part and use it to dynamically generate the Javascript code for
> the 2nd part? (without using a 2nd page).


Sounds to me like you should be looking at openthought.

One of my local perlmongers gave a talk on this recently...

http://perl.jonallen.info/talks/lightweightajax

> (I don't really know JS very well and I cannot find any "file listing"
> function in JS. If it does have such, it will solve all my problems.)


JS running in a browser is not generally allowed to access the local
filesystem.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com