473,382 Members | 1,258 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,382 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 2149
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
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.