PHP: How to pass variables from PHP to JavaScript

From The Travis van der Font Wiki
Revision as of 09:54, 30 November 2018 by Travisfont (talk | contribs) (Created page with "=== Boolean === <syntaxhighlight lang="javascript+php"> <?php $readOnly = false; ?> var readOnly = <?php echo json_encode($readOnly);?>; if (readOnly === false) { ...: ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Boolean

<?php $readOnly = false; ?>

var readOnly = <?php echo json_encode($readOnly);?>;

if (readOnly === false) { /* ... */ }