Javascript Inside Php Code
i have place javascript inside php code, like this it works perfect when i run it
Solution 1:
First, I'm pretty sure you have to do either:
<?phpif (condition) { ?> ** script stuff ** <?php } ?>
or
<?phpif (condition) : ?> ** script stuff ** <?phpendif; ?>
(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).
Solution 2:
Your problem is pretty vague...
Here's all the things I would review first :
- are you sure php runs on your distant server ?
- do you have anything on screen when running your script ?
- when you view the source code from the generated page : do you see your javascript code ?
- did you check for javascript error messages ?
Another batch of questions after the comments :)
- Did you try to change your JS code with a "basic" one, such as "alert('my code works');" ? (in order to see if your javascript code is triggered)
- If the basic alert code does not produce a popup, then you should see your browser's setup with javascript. It may not be enabled
- if it works (and you don't have any JS error messages) : try to place some more "alert" popups along your own code, in order to find where your code stops to work)
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
Post a Comment for "Javascript Inside Php Code"