I am working on a mobile app and I have an initial page that gets the users geolocation. I want to automatically submit this form after we successfully have the users geolocation. I am using jquery and jquery mobile if that helps any. Thanks!
</head>
<body>
<div id="location">
<form action="/location" method="POST" id="location" name="location">
<input type="text" id="lat" name="lat" />
<input type="text" id="long" name="long" />
<input type="submit" value="Set my location" data-theme="b" /></form>
</div>
<script>
navigator.geolocation.getCurrentPosition(
function(pos) {
$("#lat").val(pos.coords.latitude);
$("#long").val(pos.coords.longitude);
load();
}
);
</script>
</body>
Better solution is to set events onchange for both inputs.