Jump to content
Sign in to follow this  
divinedesigns1

php function in javascript help

Recommended Posts

if I have a PHP function can I call it in a javascript function? I am pulling the information from a database using PHP? or do I have to use java for this? 

Share this post


Link to post
Share on other sites

One of them runs in the browser and one of them runs on the server, so no.  What you can do is create an ajax request in Javascript and send it to the server with whatever data you want to send to tell the server what to do, and the server sends the response back.

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, justsomeguy said:

One of them runs in the browser and one of them runs on the server, so no.  What you can do is create an ajax request in Javascript and send it to the server with whatever data you want to send to tell the server what to do, and the server sends the response back.

so use the ajax to get the information from the php to then call the ajax in javascript? if i understand correctly, thanks

Share this post


Link to post
Share on other sites

Ajax is using Javascript to send a request to the server.  So you send whatever data you need to send to the server, the server gets the data and does whatever you want to do there, and you send any data you might want back to Javascript.

Share this post


Link to post
Share on other sites
On 2/7/2019 at 8:11 PM, justsomeguy said:

Ajax is using Javascript to send a request to the server.  So you send whatever data you need to send to the server, the server gets the data and does whatever you want to do there, and you send any data you might want back to Javascript.

thanks, sorry for the late reply

Share this post


Link to post
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
Sign in to follow this  

×