I have an external .js with arrays.
test = [
{
"name": "1"
}
test2 = [
{
"name": "2"
}
];
Now I want to use the url to identify the name of the array. So if someone goes on test.html he is using the test array and test2.html test2 array.
If I use
var queryArray = window.location.search.substring(1);
or
var queryArray = window.location.href
or something like this and then
document.getElementById("demo").innerHTML = queryArray.name;
it doesn't work, because he is of course looking for the array queryArray
which one doesn't exist.
Is there a way to use the url as an identifier?
I hope you can understand the point ^^
THX for every idea !!!