view.html.erb
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
location();
</script>
toggle.js
$(document).ready(function() {
$(function location()
{
alert("here in loc1233");
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(successFunction, errorFunction);
}
else {
alert("here in loc");
}
}); //showmap
$(function successFunction(position) {
var lat = position.coords.latitude;
var lot = position.coords.longitude;
alert('Your location coordinates are: Latitude:'+lat+' Longitude: '+lot);
});
});
Here when call the function location() in toggle.js, but its only give the alert
alert("here in loc1233");
its doesn't go to that rest of the line in that function. Why giving like that?
thanks