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?

:)

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"

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 is the ideal thing to do with AJAX,
can't ask me how, I dunno
in the adjacent AJAX DHTML Javascript forum there are ajax gurus for whom this is a no brainer, ask the same Q there