Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me

How to Get value from PHP in JavaScript
(1 viewing) (1) Guest
All your queries regarding
PHP Installation,
Binding Apache-PHP-MySQL,
and tonnes more... will be solved in this forum
  • Page:
  • 1
TOPIC:

How to Get value from PHP in JavaScript

How to Get value from PHP in JavaScript 1 year ago #609

  • yoko
Hello,
$variable is declared in PHP
i want to get $variable = 'myvarvalue'; from PHP to JavaScript.
i m calling JavaScript as
<s-cript type='javascript' src ='common.js'> in my page, but don't know how to send $variable to JavaScript so that i can use it in JavaScript.

Any idea how to do that?

Re: How to Get value from PHP in JavaScript 12 months ago #614

  • ivanb
Hi Yoko,

What's the reason you want to do this?

Javascript is traditionally executed on a client computer within the Javascript interpreter of the Browser in which the page is being read.

PHP is always executed on the Web server within its PHP runtime environment.

Hence, these two operate very differently.

If I knew what it is you are trying to achieve then perhaps I could try and suggest a pure PHP solution to this rather than a mix and match solution.
  • Page:
  • 1
Time to create page: 0.89 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download