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 Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I enable javascript on google?

584


How compare function works javascript?

524


What is the difference between registerclientscriptblock and registerstartupscript?

576


How would you organize your javascript code?

547


What is asynchronous javascript?

544






What are the different functional component in javascript?

548


What is called variable typing in javascript?

610


Write the point of difference between web-garden and a web-farm?

589


What are the Advantages and Disadvantages of JavaScript?

605


Can you assign an anonymous function to a variable and pass it as an argument to another function?

547


What is callback in javascript?

581


What percentage of websites use javascript?

570


What are the features of javascript?

569


How to load another html page from javascript?

624


Explain the typeof operator?

619