you just have to make sure to execute the new php on your server, otherwise it won't work
for example if you are dynamically changing the content of some "objID," this will not work
inside of your javascript somewhere:
PHP Code:
document.getElementById(objID).innerHTML = "<?php print($somevalue); ?>";
(since the new text never gets to your server, it is just changed on the user's computer)
however this would:
in you html
HTML Code:
<span onclick="yourJSfunction('showvalue.php');">Clicky</span>
in showavlue.php
PHP Code:
<?php print($somevalue); ?>
(since yourJSfunction would actually casue the file showvalue.php to execute on your server and send the results to the user's computer)
so when you print text w/ javascript, it will not compile if you just print it to your html page, you have to have the javascript call the actual php file, so that it runs on the server