CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [FishMonger] How to pass variable value from perl to Javascript: Edit Log


Aug 3, 2014, 2:16 AM

Views: 42028
Re: [FishMonger] How to pass variable value from perl to Javascript

Hi Ron,

I am declaring parameter for $user at the top of my script :

# get form parameters
my $q = new CGI;
my $user = $q->param('user');

and assigning it to the following tag :

<ul class="tsc_pagination tsc_paginationA tsc_paginationA09">
<li><a href="#" class="$user">Welcome $user</a></li></ul>

I am just calling that javascript in which is actually for a jquery menu :

<div class="dtcodes_main">
<script type="text/javascript" src="dc_scripts/dreammenu.js"></script>

The very first line of that javascript which outputs "Go Back" and "Log out" where I am trying to call my $user variable is :

document.writeln('<div class="dc-rnav"><a href="javascript:history.go(-1)" title="Go Back">Go Back</a> | <a href="" title="This will log you out">Log out</a> | <a href="" title="" >$user</a></div>');

I am trying other means to get that $user output just beside the "Log out" link where it show $user but not getting the x coordinate right, see the picture attached, like :

<div style='float: right;'><a href="">$user</a></div>

If you like I can attach both and javascript, which will give you a better idea as to how to pass $user variable value to the javascript.

Many thanks for your help!!


(This post was edited by terrykhatri531 on Aug 3, 2014, 3:55 AM)
Attachments: User.png (2.13 KB)

Edit Log:
Post edited by terrykhatri531 (User) on Aug 3, 2014, 3:55 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives