Hi,
I am new to javascript as well as ASP.NET Webapi. I want to send the output of the javascript function to asp.net webapi project. Can anyone let me know how to do that.
Scenario:
I am getting the latitude and longitude of my current location and displaying it in a label control as follows:
I took the code from google. It works fine.
Following is my html code
Code :
<html>
<head>
<script type="text/javascript">
function Location(position)//location function is defining with parameter
{
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
document.getElementById("lati").innerHTML = latitude;
document.getElementById("longi").innerHTML = longitude;
}
function findLocation() {
if (navigator.geolocation)//checking browser compatibility
{
navigator.geolocation.getCurrentPosition(Location);//getCurrentPosition method retrieve the current geographic location of the user
}
}
</script>
</head>
<body>
Latitude:<label id="lati"></label><br /><br />
Longitude:<label id="longi"></label><br /><br />
<input type="submit" onclick="findLocation();" value="Get Location" />
</body>
</html>
Now i need to send the latitude and longitude to an asp.net webapi project. How to do that?
Thanks
Regards,
RAJAN CRP