0

Hi everyone,

As the title of my topic says, I created a javascript loop that had some PHP code inside of it, hoping that every time the javascript function ran, it would re-call the PHP code inside of it.

Turns out my hopes failed - the PHP code is only ran one time when the page loads, and then the javascript function continues to be called as normal (just no PHP).

Is there a way I can get the PHP code to run every time the javascript function is called?

:)

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by almostbob
0

No
PHP is serverside, only the output of the php is sent to the browser
javascript is clientside,
the two meet in AJAX
whcih has a bit of a leaning curve...

What were you trying to accomplish
instead of "some php"

0

No
PHP is serverside, only the output of the php is sent to the browser
javascript is clientside,
the two meet in AJAX
whcih has a bit of a leaning curve...

What were you trying to accomplish
instead of "some php"

More specifically, I already have a working PHP->MySQL script that I thought was being run inside of the javascript function. The script just queries the database and returns some data which I place into a 2D array.

My goal is to just get the website to query the database when the function is called and return the data again (which may have changed since the last time the javascript function has been called).

Is this possible to do with AJAX?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.