I have some Condition at PHP and if it’s true i need php variable to get javascript function:
Something like that:
<?php
if(x == true){
$x = <script type="text/javascript">xfunction();</script>;
}
?>
I don’t really know how to get them to combination.
To invoke a function onload when rendering your document.. you can just
echoout a self executing function.or if you are trying to pass values from javascript to php you will need to make use of HTTP Request variables (POST, GET) or XHR…
Example of the XHR:
and on the php end of like access it with
$_POST['data']More reading can be done about PHP Request variables here
More information regarding XHR can be read here