I want to know what code do I need to save the data that JavaScript displays to SQL Database
(我想知道将JavaScript显示的数据保存到SQL数据库需要什么代码。)
I'm inside the Create View of my Controller.
(我在控制器的“创建”视图中。)
This is my code on the Create view that display my Javascript:(这是我在显示我的Javascript的“创建”视图上的代码:)
<div>
<script>
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition, showError);
}
else { $("#message").html("Geolocation is not supported by this
browser."); }
function showPosition(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var latlon = "Latitude: " + latitude + "<br/>" + "Longitude: " +
longitude;
$("#message").html(latlon);
}
</script>
//This Display Latitude and Longitude
<p id="message"></p>
</div>
This code is Inside the Create.CSHTML file above its default code.
(此代码位于其默认代码上方的Create.CSHTML文件中。)
It will show my current Latitude and Longitude values.(它将显示我当前的纬度和经度值。)
I need to make it save those values in SQL(我需要使其将这些值保存在SQL中)
ask by adrianex03 translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…