473,513 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Include file

I'm having the folowing problem:

I'm getting an Array from an external source, the data in the array depents
on the get variables.
These get variables should be decided by the browser, after there decided I
can created the adres to get the file with the JavaScript Array.
How do I include this file???

Basicaly what I want in the script is something like:
include(http://the.source.com/javascript/arr...tart=a&end=g);
Jul 20 '05 #1
5 1494
John Smith wrote:
I'm getting an Array from an external source, the data in the array
depents on the get variables.
These get variables should be decided by the browser, after there
decided I can created the adres to get the file with the JavaScript
Array.
How do I include this file???

Basicaly what I want in the script is something like:
include(http://the.source.com/javascript/arr...tart=a&end=g);


Does array.php produce valid js code? Then it's sufficient to include the
file as follows:

<script type="text/javascript"
src="http://the.source.com/javascript/array.php?start=a&end=g"></script>

And then access the defined variables as you would when they where local.
JW


Jul 20 '05 #2
Yes, it produce valid js code,
but the problem is that another script decides the values of a and g
array.php?start=a&end=g

"Janwillem Borleffs" <jw@jwscripts.com> schreef in bericht
news:40***********************@news.wanadoo.nl...
John Smith wrote:
I'm getting an Array from an external source, the data in the array
depents on the get variables.
These get variables should be decided by the browser, after there
decided I can created the adres to get the file with the JavaScript
Array.
How do I include this file???

Basicaly what I want in the script is something like:
include(http://the.source.com/javascript/arr...tart=a&end=g);


Does array.php produce valid js code? Then it's sufficient to include the
file as follows:

<script type="text/javascript"
src="http://the.source.com/javascript/array.php?start=a&end=g"></script>

And then access the defined variables as you would when they where local.
JW

Jul 20 '05 #3
John Smith wrote:
Yes, it produce valid js code,
but the problem is that another script decides the values of a and g
array.php?start=a&end=g


The you can write the tag dynamically:

var start = 'something';
var end = 'something';

document.write(
'<script type="text/javascript" ',
'src="http://the.source.com/javascript/array.php',
'?start=', start, '&end=', end, '">',
'<\/script>'
);
JW

Jul 20 '05 #4
I will try this but wont this give a timing problem???

"Janwillem Borleffs" <jw@jwscripts.com> schreef in bericht
news:40***********************@news.wanadoo.nl...
John Smith wrote:
Yes, it produce valid js code,
but the problem is that another script decides the values of a and g
array.php?start=a&end=g


The you can write the tag dynamically:

var start = 'something';
var end = 'something';

document.write(
'<script type="text/javascript" ',
'src="http://the.source.com/javascript/array.php',
'?start=', start, '&end=', end, '">',
'<\/script>'
);
JW

Jul 20 '05 #5
John Smith wrote:
I will try this but wont this give a timing problem???


No, unless you use the defer attribute in the script tag, the browser will
wait for the remote file to finish loading before it continues parsing the
page.
JW

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3533
by: mescaline | last post by:
Hi, Suppose a_file.cpp contains a function a_function() Now to include it in main_file.cpp I just do #include "a_file.cpp" and I'm all set. i recently came across this seemingly roundabout...
6
4305
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
28
3833
by: Ramesh | last post by:
Hi, I am currently maintaining a legacy code with a very very large code base. I am facing problems with C/C++ files having a lot of un-necessary #includes. On an average every C/C++ file has...
60
8210
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
9
13087
by: bill | last post by:
Forget the exact definition of difference between, #include <foo.h> and #include "bar.h" Normally foo.h is a standard header file, so it's path is not defined in compiler option, but I...
12
1961
by: Francois Grieu | last post by:
Can #include safely use a preprocessing token, as in #define HEADERFILE "stdio.h" #include HEADERFILE int main(void) {return printf("Hello, world\n")*0;} TIA, François Grieu
9
6397
by: zolli | last post by:
Hi, I've been banging my head against this for a while now. Hoping someone here can shed some light on what's going on. On including stdlib.h in a file, I'm seeing the following errors: ...
5
2495
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
3
2690
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
6
2094
by: tshad | last post by:
In my User control, I tried to do this: *************************************************************************** <Script runat="server"> Public ClientName As String = "<!-- #include file =...
0
7257
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7157
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7379
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7521
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.