Why can't I run Javascript in my index.php file?!

I’ve been designing websites for a couple years, but I’ve only ever designed static .html sites. It’s been a lot of work. I very recently discovered the <?php include() ?> tag. The website that I work on the most is my church’s site, www.therockwired.org. I’ve been using static pages and images to code these sites.

What I’ve done so far is include the header, side-menu, and footer into their own .php files, and used the <?php include() ?> script to place them on every page.

My next step was to use jQuery to make* an image slideshow, complete with linked images. However, I’ve learned (during this process) that the PHP executes on the server-side, and the Javascript executes on the browser side, and in a .php file, everything is executed server-side, so the Javascript just never happens. PHP doesn’t know what to do with it, so it is just ignored.

How can I fix this? I tried renaming the file from index.php (which executed everything but the Javascript) to index.html (which executed just the Javascript and no "<?php include() ?>"s).

I hope my question makes sense, and I don’t sound totally stupid. I am sure that there is a simple solution, I just scanned the forums EVERYWHERE last night for a couple hours, and everyone else seems to just know what to do with this.

Please help!

*And by MAKE, I mean use someone else’s code (because I don’t know jQuery either!)

I have no idea why its working now. Thanks for your consideration, though.

Sponsor our Newsletter | Privacy Policy | Terms of Service