Re: Giving Javascript code access to Perl variables
J Wermont <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Eric wrote: > Javascript is not actualy reading the value from perl. When you print out > the javascript it is inserting the value from the variable in perl into that > spot in the string. That makes sense. I guess (in my example), the Javascript isn't really evaluating the variable $loopcount at all, but simply sees a 4. > The moral, don't try to communicate between the two. Instead make your perl > output dynamic javascript. Hmm, I think that's what I'm doing. Do you mean that the Javascript code is being output by Perl code, like this: print << "ENDOFPAGE"; # This is a line of Perl code <script language="Javascript" blah blah> ... a bunch of Javascript code ... </script> ENDOFPAGE # Back to Perl If so, that is already what I'm doing. Actually, I've experimented some more and have discovered that Perl array values will also be substituted into the Javascript code, so that the Javascript sees the actual value. But it only works if the subscript is an actual number. I'll have to figure out a way to code it so that the subscript can be a Perl variable. Otherwise, there's no point to doing this, since I'd always have to know how many items were in the array, and how often does one know that? Thanks. J Wermont -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/[email protected]