What am I missing here? It seems simple but I can't figure out why the 2nd alert shows "undefined" for the var id
<input type='button' class='getLoc' id=‘s13' value=‘s13’>
<script>
$(function(){
$('.getLoc').click(function(){
var id = $(this).attr('id');
alert(id); //<-- shows s13
navigator.geolocation.getCurrentPosition(function(position,id){
var lat = position.coords.latitude;
var lon = position.coords.longitude;
alert(lat+","+lon+","+id); //<-- shows undefined for id
});
});
});
</script>