Arbu 0 Posted July 1, 2020 Report Share Posted July 1, 2020 I'm using this code <?php if (isset($_POST["json"])) : ?> loadfile('<?php echo $_POST["json"] ?>'); <?php endif; ?> to insert a command into my scrjavascript script and it appears like this: loadfile('{ ... ... }'); But I get a message for the loadfile line "Uncaught SyntaxError: Invalid or unexpected token". I can't see anything wrong. Why am I getting this error? Quote Link to post Share on other sites
Ingolme 1,027 Posted July 2, 2020 Report Share Posted July 2, 2020 It is probably that there is a quotation mark in the JSON contents. Quote Link to post Share on other sites
Arbu 0 Posted July 2, 2020 Author Report Share Posted July 2, 2020 5 hours ago, Ingolme said: It is probably that there is a quotation mark in the JSON contents. Yes, there are loads. It seems that if I remove the single quotes around the php command the error goes away. I don't actually understand why they were there in the first place. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.