Arbu Posted July 1, 2020 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? Link to comment Share on other sites More sharing options...
Ingolme Posted July 2, 2020 Share Posted July 2, 2020 It is probably that there is a quotation mark in the JSON contents. Link to comment Share on other sites More sharing options...
Arbu Posted July 2, 2020 Author 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now