Is it possible for javascript code to interact with php code?

Asked

Viewed 41 times

0

I know that javascript and a clinte side language which is interpreted by the client’s browser and which PHP is a server side language interpreted by the server but a code is possible javascript be used within a code PHP I’ll leave a page as an example.

<html>
<body>
<h1>Javascript & PHP</h1>
<script>
x = 1;
</script>
<?php
echo($x)
?>
</body>
</html>
  • See also http://answall.com/q/89802/101

  • interesting is that with the python print() function it is also possible to generate javascript code?

  • This way you exemplified is not possible... you can use php to generate javascript code as @bigown commented or you can use Xmlhttprequest to search for information from a php code. The following is documentation on Xmlhttprequest: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.