从GPS获取当前标记位置并保存到mySQL

I have following JS code, form this code i need to set default location to my current GPS location,

var map = new google.maps.Map(document.getElementById('map_canvas'), {
    zoom: 1,
    center: new google.maps.LatLng(35.137879, -82.836914),
    mapTypeId: google.maps.MapTypeId.ROADMAP,
        zoom: 20
});

var myMarker = new google.maps.Marker({
    position: new google.maps.LatLng(47.651968, 9.478485),
    draggable: true
});


google.maps.event.addListener(myMarker, 'dragend', function (evt) {
    document.getElementById('current').innerHTML = '<p>Marker dropped: Current Lat: ' + evt.latLng.lat().toFixed(3) + ' Current Lng: ' + evt.latLng.lng().toFixed(3) + '</p>';
});

google.maps.event.addListener(myMarker, 'dragstart', function (evt) {
    document.getElementById('current').innerHTML = '<p>Currently dragging marker...</p>';
});

map.setCenter(myMarker.position);
myMarker.setMap(map);

and after setup my marker (if i need to change location), then i need a button to submit, after submit button it will save to my MySQL database. Anyone can help on this?

You could use an ajax call for posting the data to the server and then server side provide for store di values in database

Assuming that you have a server program for store the data named your_action_on_server.php you could extend your drag end event this is only the sending part (you must provide the server side store function related toy your db connection)

google.maps.event.addListener(myMarker, 'dragend', function (evt) {
    document.getElementById('current').innerHTML = '<p>Marker dropped: Current Lat: ' + evt.latLng.lat().toFixed(3) + ' Current Lng: ' + evt.latLng.lng().toFixed(3) + '</p>';
    $.post( 'your_action_on_server.php', { 
                   lat:evt.latLng.lat().toFixed(3),
                  lng: evt.latLng.lng().toFixed(3)                  
                },
                      function (data) { 
                      // you code for succcess from server
          });
  });

For get the current location you could use the The geolocation object api
see https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation for more

  if ("geolocation" in navigator) {
    /* geolocation is available */
  } else {
    /* geolocation IS NOT available */
  }

.....

  navigator.geolocation.getCurrentPosition(function(position) {
    do_something(position.coords.latitude, position.coords.longitude);
  });