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 is the default scope in javascript?
Where do you put javascript in html?
How do you define a class and its constructor?
How to port a GUI application onto Web
What does unshift() function do in Javascript?
What is the difference between undefined and object?
How to select an element by id and swapping an image?
What do “1”+2+4 evaluate to?
Is a relation always a function?
What is the result of below given line of code in java script? 5+4+'7'?
print the following using loop. 54321 4321 321 21 1
2 Answers Delhi Public School,
When would you use var in your declaration and when you wouldn’t?