Hello…
Please, somebody can post a working example?
I can’t solve this…
Thanks!
I solved this of this way:
- into your App creates a new field
- from javascript asign the value to new field created.
- Now, you can read the value from new field from PHP.
i’m working in a blank config module…
Solved… Sample:
?>
<script> document.cookie = {"myJavascriptVar" : window.innerWidth} </script>
<?php
$SG_Width= $_COOKIE['myJavascriptVar'];
echo $SG_Width;
if ($SG_Width >= 1000) {
echo "mayor<br>";
} else {
echo "menor<br>";
}
1 Like
php runs first, prio to javascript so you question seems exotic to me
when you submit, php takes values from the form.
you cannot exchange variables unless u use COOKIE/form/form fields/post/get parameters.
IMHO
Yes… not work ok this code…
the best solution is
$SG_Width = "<script>document.write(window.innerWidth).value;</script>";
But $SG_Width, in a echo, show the correct result…and when i use in a asignattion, contains the script text…
And i need the value to set the width of an slide…
I’ll keep trying…