One way to do this is by invoking the perl script on an iframe, the script returning html with a javascript that dumps the info into the main html page by calling a javascript method there defined.

In other words:
Create the page's html with an invisible iframe like this <iframe src="your script" width="0" height="0">, and a javascript method, lets say Dumper.

Create your script that does whatever it has to do, and then output html code with a javascript function that holds the info you want to display and passes it to the Dumper function by calling parent.Dumper(txt);

In code:
Main page's HTML ... <script language="javascript"> function Dumper(txt) { // write txt somewhere on the page } </script> ... <iframe src="perlscript.pl" width=0 height=0> ....
Now the the BODY for the HTML returned by the script
<body> <script language="javascript"> var txt='the info you want to show'; parent.Dumper(txt); </script> </body> ...

In reply to Re: call javascript from perl by olus
in thread call javascript from perl by pvilleSE

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.