Jump to content

php / java script src


pneudralics

Recommended Posts

I wasn't sure where to put this thread. I'm trying to get a javascript src to display a php page. The problem is when I use php on the page like test2.php below it doesn't display anything. If I use plain text it works. What can I do to let it display php echos?

 

test.php

<script type="text/javascript" src="http://localhost/test.php"></script>

 

test2.php

//The below works
var test = '';

test = "<div style=\"color:#FF0000;\">yay</div>";

document.write(test);

//The below does not work
var test = '';

test = "<div style=\"color:#FF0000;\"><?php echo 'blahblah'; ?></div>";

document.write(test);

Link to comment
https://forums.phpfreaks.com/topic/186204-php-java-script-src/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.