Click here to Skip to main content
13,088,711 members (53,199 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i find this code it get me location but i don't know how to save client location in sql database to retrieval it Later

<script src="">
<script type="text/javascript">
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(function (position) {
            var latitude = position.coords.latitude;
            var longitude = position.coords.longitude;
            var coords = new google.maps.LatLng(latitude, longitude);
            var mapOptions = {
                zoom: 15,
                center: coords,
                mapTypeControl: true,
                navigationControlOptions: {
                    style: google.maps.NavigationControlStyle.SMALL
                mapTypeId: google.maps.MapTypeId.ROADMAP
            map = new google.maps.Map(
                document.getElementById("mapContainer"), mapOptions
            var marker = new google.maps.Marker({
                position: coords,
                map: map,
                title: "Your current location!"
    } else {
        alert("Geolocation API is not supported in your browser.");
<style type="text/css">
#mapContainer {
height: 500px;
width: 800px;
border:10px solid #eaeaea;
<div id="mapContainer"></div>
Posted 29-Mar-13 1:46am
aspnet_regiis -i 29-Mar-13 7:54am
What have you tried?
hany1002 29-Mar-13 8:10am
i would like to save location show the map in sql database
aspnet_regiis -i 29-Mar-13 8:18am
I would like to have a cheeze pizza and coke for dinner today... But the question was - What have you tried (other than copy pasting the above code from ?
ThePhantomUpvoter 29-Mar-13 8:38am
5+ for that one.
aspnet_regiis -i 29-Mar-13 9:27am
mr.priyank 29-Mar-13 10:07am
Plz dont make fun of anyones question. Just try to see what he is trying to ask.
aspnet_regiis -i 29-Mar-13 10:25am
No body is trying to make fun.. Do you think we are paid to help him ?? You and your friend need to read these links What have you tried ? ^ and Rules for posting questions on code project ^
ryanb31 29-Mar-13 8:14am
You'll have to write code to save it to the database. Where are you stuck?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

#mapContainer {
height: 500px;
width: 800px;
border:10px solid #eaeaea;

Now Save The Value Of These Two Hidden Tagas.
aspnet_regiis -i 29-Mar-13 10:29am
Nice answer.. But the OP needs to save it in the database.. I dont see the values being saved in the database...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 29 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100