i have the following problem. I have a div like the following:
<div id="1234">
[...........]
</div>
The main task was to have into a function, a variable with this form:
var locations=[[...........]];
So, the html content of the above div, i've got it into specific function, with following code:
var location= document.getElementById("1234").innerHTML;
var locations = eval('['+location+']');
With above codes, i have the wanted result, that is a variable, as i said before, like the following:
var locations=[[...........]];
This means that with eval(); the code is working good in the case that inside a div i have only html code.
But, for a more difficult case, what if inside div i have a javascript that write the same result:
<div id="1234">
<script>
document.write("<script src=\"/feeds/posts/summary/-/<data:content/>?max-results=3&orderby=published&alt=json-in-script&callback=map_locations\"><\/script>");
</script>
</div>
If i use the same codes
var location= document.getElementById("1234").innerHTML;
var locations = eval('['+location+']');
code is not working, and console log shows the following
VM8144:2 Uncaught SyntaxError: Unexpected token <
at mainMap ((index):982)
Thanks a lot for your time....