-1

I am using Google JavaScript API with geocoding and heatmap. But I am having some trouble. Here is my script:

content of coords.js:

eqfeed_callback()

My question is, why I can not call the function heatMapVisualize() anywhere else except the eqfeed_callback function. When I put the function call of heatMapVisualize() somewhere else, it will not do it. How ever the eqfeed_callback is empty.

My second question which is depending on the first one. How can I get rid of this function theese lines:

var script = document.createElement('script');
script.src = 'https://www.stud.fit.vutbr.cz/~xhalin01/BP/coords.js';
document.getElementsByTagName('head')[0].appendChild(script);

I dont need them anymore. There I used to store the locations for heatmapdata, but now I do it via Google Geocoder. I am new to Javascript so excuse my dumb question But I will put bounty on this.

nocturne
  • 627
  • 3
  • 12
  • 39

1 Answers1

1

If you call it outside the callback the variables used WITHIN that function are only initialized to the defaults set at the top of your script - basically nothing/empty - undefined and empty array.

Put that script in as a tag ABOVE the others with src= attribute set.

Mark Schultheiss
  • 32,614
  • 12
  • 69
  • 100
  • I do not really understand since I have not many experience in javascript. Why I should keep that eqfeed_callback when I dont use it anymore. I dont use that file coords.js – nocturne Feb 26 '17 at 14:49
  • So just remove those lines? You can remove anything and not impact your code if it is not used. – Mark Schultheiss Feb 26 '17 at 18:29