Displaying Marker With Latlong Json Data In Biostall-google-maps-v3 Api Library Issue
i have a simple AJAX that will get all data from MYSQL with my controller then display all data with its latitude and longitude when searched: $(document).ready(function () { $
Solution 1:
The problem is google.maps.LatLng is expecting two numbers and you are passing it a string from your database (assuming searchMapDataResult['latlong'] is returning a comma delimited string). So you will need to
- Split the latitude and longitude
- Convert them into numbers
- Generate the google.maps.LatLng
Like this:
var latLngArray = searchMapDataResult['latlong'].split(',');
var latitude = parseFloat(latLngArray[0]);
var longitude = parseFloat(latLngArray[1]);
var myLatLong = new google.maps.LatLng(latitude,longitude );
Post a Comment for "Displaying Marker With Latlong Json Data In Biostall-google-maps-v3 Api Library Issue"