473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

FAQ Topic - How do I get a perl/asp/php variable into client-side js?

-----------------------------------------------------------------------
FAQ Topic - How do I get a perl/asp/php variable into
client-side js?
-----------------------------------------------------------------------

Use the server-side language to generate the javascript:

var jsvar="<%= aspvar %>";
var jsvar="<?php echo $phpvar ?>";
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.

Apr 25 '07 #1
3 2151
FAQ server wrote on 26 apr 2007 in comp.lang.javascript:
-----------------------------------------------------------------------
FAQ Topic - How do I get a perl/asp/php variable into
client-side js?
-----------------------------------------------------------------------

Use the server-side language to generate the javascript:

var jsvar="<%= aspvar %>";
var jsvar="<?php echo $phpvar ?>";
This is only for strings, so that c/should be mentioned.

Is a warning for inside quotes or new lines appropriate,
as the variable value is semt to the client as a litteral?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 25 '07 #2
Evertjan. said the following on 4/25/2007 7:09 PM:
FAQ server wrote on 26 apr 2007 in comp.lang.javascript:
>-----------------------------------------------------------------------
FAQ Topic - How do I get a perl/asp/php variable into
client-side js?
-----------------------------------------------------------------------

Use the server-side language to generate the javascript:

var jsvar="<%= aspvar %>";
var jsvar="<?php echo $phpvar ?>";

This is only for strings, so that c/should be mentioned.
While that is strictly true, shouldn't issues of getting quotes to the
browser from PHP/ASP be a PHP/ASP question? Personally, I don't even
think that entry should be there anymore, it is a PHP/ASP question.
Is a warning for inside quotes or new lines appropriate,
as the variable value is semt to the client as a litteral?
Again, to me, it isn't a JS question as much as a PHP/ASP question.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 26 '07 #3
Randy Webb wrote on 26 apr 2007 in comp.lang.javascript:
Evertjan. said the following on 4/25/2007 7:09 PM:
>FAQ server wrote on 26 apr 2007 in comp.lang.javascript:
>>-----------------------------------------------------------------------
FAQ Topic - How do I get a perl/asp/php variable into
client-side js?
-----------------------------------------------------------------------

Use the server-side language to generate the javascript:

var jsvar="<%= aspvar %>";
var jsvar="<?php echo $phpvar ?>";

This is only for strings, so that c/should be mentioned.

While that is strictly true, shouldn't issues of getting quotes to the
browser from PHP/ASP be a PHP/ASP question? Personally, I don't even
think that entry should be there anymore, it is a PHP/ASP question.
>Is a warning for inside quotes or new lines appropriate,
as the variable value is semt to the client as a litteral?

Again, to me, it isn't a JS question as much as a PHP/ASP question.
Agree! [ as long as ASP-jscript is not part of this FAQ. ]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 26 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
1
by: bobano | last post by:
Hi everyone, I am writing a POP3 Client program in Perl. You connect to a POP3 Server and have a running conversation with the mail server using commands from the RFC 1939 Post Office Protocol....
4
by: Patricia Mindanao | last post by:
I want to call cgi perl scripts on my web hosters server from my HTML web pages (on the the web hosters server too). It occurs sometimes (especially during development phase) that these cgi-perl...
20
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get a perl/asp/php variable into client-side js?...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.