Link to home
Start Free TrialLog in
Avatar of Cybervanes
Cybervanes

asked on

JavaScript to write and execute PHP script code to a div tag

I know php is server based and only executes when the page first loads (at run time)

my question is;
Can you use JavaScript to write and execute PHP script loaded from an external file?

this is what Ive tried;
<script type="text/javascript">
function showAreaOfTown(){
      var target = document.createElement( "script" );
      target.setAttribute( "src", "areaOfTown.php" );
      document.getElementById("areaOfTown").appendChild( target ); //the div tag
}
</script>

Avatar of Cybervanes
Cybervanes

ASKER

nobody has any ideas?
SOLUTION
Avatar of LordOfPorts
LordOfPorts
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial