Reputation: 170
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
Upvotes: -1
Views: 2093
Reputation: 497
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
Upvotes: 0
Reputation: 41823
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).
Upvotes: 2