简体   繁体   中英

Google Maps API: Removing markers you don't have anymore?

So every question I've seen that asked this so far recommended to push markers into a global array and then deleting them one by one; but when I was following the tutorial there was no global array for markers there so I didn't bother. In my program, I am loading the markers from an xml file, like in this tutoral , except instead of using a link I am using a file on my system named "test.xml". Since the first time I "ran" my php script (since i've been testing it) I've changed the contents of the xml file. Now, a marker that is not even in the xml file is still showing up whenever I test my map. To put it more clearly:

<?xml version="1.0" encoding="UTF-8"?>
<markers>
<marker name="Somewhere" lat="40.000000" lng="-40.000000"/>
</markers>

Is the only thing currently in my xml file named "test.xml." However, when I try testing my google map, another marker from a previous version of test.xml shows up. So I have 2 markers showing up, when my xml file clearly now only has one.

How can I remove the old marker?

Your app is probably using a cached version of test.xml. You can force all included files to be reloaded from disk in IE by hitting Ctrl-F5. Not sure what Firefox & Chrome keys are for this,...

HTH, Jim

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM