gps coordinates

Colanth

New Member
i want to take gps coordinates from a telephone for my school project. It's C# and Asp.Net web project.Asp. Net Code:\[code\]<script type='text/javascipt'>function success(position) {console.log(position.coords.latitude);console.log(position.coords.longitude);}function SendForm() {var latitude = $get("position.coords.latitude").value;var longitude = $get("position.coords.longitude").value;PageMethods.SendLocation(latitude, longitude);}function error(msg) {console.log(msg);}if (navigator.geolocation) {navigator.geolocation.getcurrentposition(success, error);} else {error('not supported');}</script>\[/code\]Code behind :\[code\] [System.Web.Services.WebMethod] public static string SendLocation(object latitude, object longitude ) { // location data }\[/code\]i want to take location when user click log in button. how to call this java script method. and is these all correct?
 
Back
Top