what is the dependence on if the javascript gets called or Executed? I have two functions which both get called the same way, to be precise:
[self.mapView stringByEvaluatingJavaScriptFromString:
[NSString stringWithFormat:@"setMarkerAtPosition(%f,%f)",
latlong.latitude, latlong.longitude]];
and
[self.mapView stringByEvaluatingJavaScriptFromString:@"test()"];
but calculateRoute() gets executed while test() is not. How come?
function setMarkerAtPosition(lat, long){
var position = new google.maps.LatLng(lat, long);
var marker = new google.maps.Marker({position: position,
map: map,
title:"Hello World!",
animation: google.maps.Animation.DROP});
var content = "Ich bin eine normale Infobox";
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(content);
infowindow.open(map,marker);
reportClickedMarker();
});
}
function test(){
alert(currentPosition.latitude + ', ' + currentPosition.longitude);
}
Thank you
You’re not calling
calculateRoute()anywhere.test()is getting called because you are calling it with: