Call External Javascript using php

Posted by Ajith on Stack Overflow See other posts from Stack Overflow or by Ajith
Published on 2010-05-14T14:22:50Z Indexed on 2010/06/18 8:33 UTC
Read the original article Hit count: 99

Filed under:
|

I am try to add a javascript using php as follows

<?php
Header("content-type: application/x-javascript");
$serverIP=$_SERVER['REMOTE_ADDR'];
echo "document.write(\"Your IP address is: <b>" . $serverIP . "</b>\")";
?>

Here i need to print my output as follows

Your IP address is: 127.0.0.1

but it is showing result like

document.write("Your IP address is: <b>127.0.0.1</b>").

i am using apache server in ubuntu.What is wrong with me. help me please...

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript