[COLOR=”Red”][SIZE=”5″]This is a “can I” or “is it possible” question:
If I have one main html file that calls an external JS file that contains only an array (infoArray), know I can do this
Code for “Main.html”
[code]
<html>
<head>
<title>Main File</title>
<script type=”text/javascript” src=”infoArray_file1.js”>,/script>
</head>
<body>
<!– … code to use and display information in infoArray… –>
</body>
</html>
Code for “inforArray_file1.js”
[code]
var info = [
[‘Destrict1′,’State1’],
[‘Name1′,’City1′,’Phone1’],
[‘Name2′,’City2′,’Phone2’],
[‘Name3′,’City3′,’Phone3’],
[‘Name4′,’City4′,’Phone4’],
[‘Name5′,’City5′,’Phone5’]
]
If later I then create a different external infoArray_file with different information, different length, etc.
Code for “inforArray_file2.js”
[code]
var info = [
[‘Destrict2′,’State2’],
[‘Name10′,’City10′,’Phone10’],
[‘Name20′,’City20′,’Phone20’],
[‘Name30′,’City30′,’Phone30’]
];
[COLOR=”Red”][SIZE=”5″]Now the question…
Instead of 2 different main.html files, to load the different inforArray.js files, can I somehow overwrite the contents of the infoArray
AFTER the information has been loaded from the first external JS file?
I have seen code that adds elements to the <head> section as the page loads,
is there something similar to load/change array information during or after page load?
Or is this something that should be done by having text information in the file and loading with ajax and processing to an array afterward?