0 Replies - 1195 Views - Last Post: 19 November 2012 - 06:04 PM

#1 hondakillrsx  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 29
  • Joined: 08-March 12

passing a variable between functions

Posted 19 November 2012 - 06:04 PM

The getFishing_in() function below calls a php file which returns the data and then creates google maps markers for each of the markers that are returned from an XML file. What I'm trying to do is take the ID variable and pass it to a textbox which is updated when a marker is clicked. Everything works but the updating of the 'test' textbox, it actually passes the first id that is pulled in from the XML file but it never passes another variable when I click on a new marker, can anyone see why not, it has to be something easy that I'm missing.... Let me know if you need any more info.

      function getFishing_in(){
		var name = "XML_Fishing_in.php";
		fishingUrl_in(name, function(data) {
        var xml = data.responseXML;
        var markers = xml.documentElement.getElementsByTagName("marker");
        for (var i = 0; i < markers.length; i++) {
          var id = markers[i].getAttribute("id");		
          var Fishhtml = //HTML content
          fish_in_Array.push(Fish_in_mark);
          bindInfoWindow6(Fish_in_mark, map, Fishinfo, Fishhtml, id);
		  
		}
		
		}); 
	}

    function bindInfoWindow6(marker, map, infoWindow, html, id) {
      google.maps.event.addListener(marker, 'click', function() {
        infowindow.setContent(html);
        infowindow.open(map, marker);
      });
      document.getElementById("test").value = id;
      }





Is This A Good Question/Topic? 0
  • +

Page 1 of 1