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 ?



Is it possible to assign a php variable to javascript ? And also is it possible to fetch the page ..

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

Post New Answer

More JavaScript Interview Questions

How do you check if a string is a number javascript?

0 Answers  


What is closure? Give an example.

0 Answers  


Is it possible make a call to server side event of any button using javascript?

0 Answers  


Is javascript enabled on my computer?

0 Answers  


Difference between Client side JavaScript and Server side JavaScript?

1 Answers  


What is the ‘Strict’ mode in JavaScript and how can it be enabled?

0 Answers  


What are javascript functions?

0 Answers  


What is a prompt box in javascript?

0 Answers  


what is a code in vb amount display in words

0 Answers  


Explain hoisting in javascript?

0 Answers  


Which keyword is used to print the text in the screen?

0 Answers  


Explain unescape() in javascript?

0 Answers  


Categories