Jump to content

is it possible to add php within js?


divinedesigns1

Recommended Posts

is there a way to add a php file or code within a javascript file? i believe you can do this with ajax but is it possible to be done in javascript? why i am asking is because i was to popular my javascript list with information within a database, both php and js are within a file.

 

is there a way to do this without placing the code exactly onto the main page?

Link to comment
Share on other sites

Agree with DaveJ. Just use Javascript to make an Ajax request to get the data from a PHP script, and populate the dropdown dynamically.

Link to comment
Share on other sites

Agree with DaveJ. Just use Javascript to make an Ajax request to get the data from a PHP script, and populate the dropdown dynamically.

ok thanks

 

You could have an HTML file, a JS file, and a Php file and then use Ajax. No code would be in the HTML file.

thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...