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 |
How do I turn on javascript on my phone?
What does "1"+2+4 evaluate to?
Which built-in method combines the text of two strings and returns a new string?
What is difference between javascript and jscript?
What is emotional closure?
What causes memory leaks?
How to add new elements dynamically?
How do you know if a set of points is a function?
What is difference between ajax and javascript?
What is noscript tag?
Which is best for front end?
Which is better for or foreach in javascript?