0
This is my code, but for some reason it does not show the requested data.. I would like to see with you if I am doing something wrong.
PHP
<?php
$var1 = 1;
$var2 = 2;
$var3 = 3;
$myobj -> foo1 = $var1;
$myobj -> foo2 = $var2;
$myobj -> foo3 = $var3;
$json = json_encode( $myobj, true );
?>
javascript:
<script>
var json = <?php echo "$json"; ?>;
document.getElementById("ID").innerHTML = json.foo2;
</script>
There is no need to use formwork for what you are using in the question, please do not reverse the edition.
– user28595
Really, I just realized after hahaha obg
– L.Bravo
I noticed q Voce changed the code, unfortunately my reverse undoes it, Voce can edit and fix your code again?
– user28595
It is not necessary to had turned a variable into string unintentionally
– L.Bravo
Missing are the
;
at the end of the lines and thistrue
appears to be invalid.– Sam
The
;
was inattention issue anyway.. are correct in the original code.. I will see about the propertytrue
..– L.Bravo