Unstoppable Domains โ€” Get your daily AI drops report

Include external file in java script var

Spacemail by SpaceshipSpacemail by Spaceship
Watch
Impact
0
My webpage is a .asp file.

Is it possible to read a value from external file and store it in a javascript var.


The external file only contains a price (digits and a decimal point).

The filename is price1.asp but can be .txt, .inc, .whatever....

var price1=(199.95);

I want to put the price 199.95 into the external file price1.asp.

This doesn't work, but will help you understand what I want to achieve.

var price1=(<!--#include file="include/price1.asp"-->);



This is no good either, because I can't store the value in the javascript variable.


<%
Set fs = CreateObject("Scripting.FileSystemObject")

Set wfile = fs.OpenTextFile("d:/test.txt")
price1 = wfile.ReadLine

wfile.close
Set wfile=nothing
Set fs=nothing

%>


// This showed the correct value

<%
response.write (price1)
%>

I don't know database, is there another way.
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
Isn't (<!--#include file="include/price1.asp"--> ); CGI???
 
0
•••
Re: include external file in java script var

Originally posted by Niko
How do I include an external file called price1.asp into a java script variable.

var price1=(199.95);

I want to put the price 199.95 into a external file called price1.asp.

I've tried this but it doesn't work
var price1=(<!--#include file="include/price1.asp"-->);

I'd rather not use a database thanks.

Are you trying to include this price1.asp file in another .asp file? All you should really need to do if so is save the text 199.95 in the price1.asp file and then use the include directive to include it where you want on the other page.

There's no way to include external files with JavaScript alone, or at least not that I know of. :D Anyways if you can be a little more specific that would help. :)

Originally posted by x3knet
Isn't (<!--#include file="include/price1.asp"--> ); CGI???
Nope, it's Server Side Includes. B-)
 
0
•••
Yeah, that's what I meant, lol. CGI is along the same lines as SSI.
 
0
•••
Ah, good 'ole SSIs. I still prefer PHP includes myself. :)
 
0
•••
These forums are a waste of time,
People ask for help,
and all we get is smart arse comments!
 
0
•••
So, after one post you came to that conclusion?

Mike
 
0
•••
Originally posted by Tippy
So, after one post you came to that conclusion?

Mike

No,
after 4 useless replys,
you just made it 5 :bah:
 
0
•••
Originally posted by Niko
No,
after 4 useless replys,
you just made it 5 :bah:
You're the one that is making the useless replies. If you can't appreciate people trying to help and answer questions when you're asked to clarify or explain yourself in more detail and be polite then don't post.
 
0
•••
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back