/    Sign up×
Community /Pin to ProfileBookmark

How to acces JS var from Perl CGI?

I have a var s in my JS code. And now I need to access this var s from my Perl CGI code. How do I do it?

Thx.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@felgallApr 03.2006 — To pass a field from javascript to a cgi you add it to the end of the URL of the cgi

var t1 = 'anything';

location.href = 'myperl.cgi?t1=' +t1;

The cgi can then read it using

($key, $value) = split(/=/, $ENV{'QUERY_STRING"});

and now what was in Javascript variable t1 is now in PERL variable $t1.
Copy linkTweet thisAlerts:
@userauthorApr 03.2006 — Sorry, still doesn't work for me.

JS:

var s = 'abc';

Perl:

I need $str to be the value of var s.

Please help!
×

Success!

Help @user spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...