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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...