Sunday, August 22nd, 2010
myscript.php is either an absolute or relative path to a PHP script instead of the usual .js file. You can even pass parameters to the PHP script through the URL string:
Your PHP script can then get to these parameters using the global variable
Here’s a basic example of a PHP script-
//"ip.php" example- display user IP address on any page
echo "document.write(\"Your IP address is: " . $serverIP . "\")";
Output: Your IP address is: 192.168.18.1
document.write() as part the content to send back to the page.
<script></script>), as just like inside a regular .js file, this isn’t required nor valid.