[thelist] ASP to populate .js file?
Stephen Caudill
SCaudill at municode.com
Wed Apr 7 08:29:12 CDT 2004
--------------- Maximillian Schwanekamp wrote: ---------------
:: Or alternatively, if I rename the file.js to file.asp, and then
:: do some SQL queries from there, will it still function as a
:: JavaScript file?
:
: Assuming you're talking ASP 3.0 not .NET: Yes, you'll want to
: change the ext to .asp. I use filename_js.asp as a convention.
: Use Response.AddHeader before your output starts:
: <%
: Response.AddHeader "Content-type", "application/x-javascript"
: %>
: //followed by JS code, or ASP that outputs JS code.
:
: Maximillian Von Schwanekamp
: NeptuneWebworks.com
: voice: 541-302-1438
: fax: 208-730-6504
Or even better, use the FileSystemObject[1] to open the .js file
as a stream, use ASP to generate your JavaScript, and write this
to the .js file.
-Stephen
http://www.mechavox.com/
[1] http://www.devguru.com/Technologies/vbscript/quickref/filesystemobject.html
More information about the thelist
mailing list