outputting javascript from a php script?
| From: | Jeffry Killen | Date: | Wed, 10 Dec 2014 00:13:05 +0000 |
| Subject: | outputting javascript from a php script? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-324109@lists.php.net to get a copy of this message | ||
One short question:
If I have a javascript script tag in a page that sets the src attribute to a php script
Before I have the php script send the response via print or echo I have to
call header('content-type: <?>');
so what would be the content type for javascript code?
text/javascript
or
application-x/javascript
or ?
Apologies if this is considered off topic
I have done this with css and used header('content-type text/css')
Also I figured out how to get a self processing page to send a
response to an ajax request sent to it by calling header('content-type:text/plain')
for a plain text response.
Thank you for time and attention
JK