Anyone know why this will work:
var wickedLocation = new google.maps.LatLng(44.767778, -93.2775);
But this won't:
var wickedCoords = "44.767778, -93.2775";
var wickedLocation = new google.maps.LatLng(wickedCoords);
I tried passing the latitude and longitude as separate variables and that didn't do the trick either. How can I pass the coordinates successfully as a variable? Thanks!
If you are getting the coordinates as a string, in the format you showed in your example, you could do this:
var b=wickedCoords.split(",");
var wickedLocation=new google.maps.LatLng(parseFloat(b[0]), parseFloat(b[1]));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With