Jump to content

can you use php in a javascript file?


jwk811

Recommended Posts

If you want to generate javascript using php, then yes you can.  Just set your script tag to point to the php script, and have your php script output javascript.

But there is no way to "include" a php file from plain javascript.  Like Toon said, you can use ajax to call a php script from javascript and get the results.
ok say i want to check a form to see if there is input  in each place.. id put onSubmit="check.js" and in the check .js file i can have php in it? and how could i get it to out put an alert if there was no input? could you please give me something to look at? thank you

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.