i have place javascript inside php code, like this <?php if(condition) { ?><script>do some scripting here</script><?php } ?>
it works perfect when i run it in local. but when i upload it to the server it doesnt run.. the javascript doesnt work. Can anyone please help. thanks, Devan
First, I'm pretty sure you have to do either:
<?php if (condition) { ?> ** script stuff ** <?php } ?>
or
<?php if (condition) : ?> ** script stuff ** <?php endif; ?>
(Your script has no scope on the if
statement, although that could be a copy/paste error).
Second, it could be your script (perhaps one of the Javascript files such as jQuery isn't on your server).
Your problem is pretty vague...
Here's all the things I would review first :
Another batch of questions after the comments :)
This will not provide you a direct answer to your problem, but will help you to find more details on your problem, and will help us find an answer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.