Is it possible to assign a php variable to javascript ? And
also is it possible to fetch the page contents if the url
is not under our control ?
Answer / gagan rana
Yes ,it is possible by doing like the following:
<?php
$x = 'hai!';
echo "<script>var x = '" . $x . "';</script>";
?>
| Is This Answer Correct ? | 3 Yes | 0 No |
What are the different ways to create an array in javascript?
How to call a function inside a function in javascript?
What is the syntax of ‘self invoking function’? Give an example?
How to write html code dynamically using JavaScript?
Which parameter of load ()' s callback function has the data?
How do you write an if statement in javascript?
How do I start a javascript project?
Can I learn javascript without html?
How to create arrays in javascript?
What do you use javascript for?
What is rest parameters in javascript?
How can an HTMLCollection be traversed?