I have a webpage that loads and runs jquery once the page is ready, like this:
$(document).ready(function () {
navigator.geolocation.getCurrentPosition(showPosition, positionError);
function showPosition(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
document.getElementById('div_latitude').innerHTML = latitude;
document.getElementById('div_longitude').innerHTML = longitude;
}
function positionError(position) {
alert("Error: " + position.code);
}
});
After I have assigned the div_latitude and div_longitude their values, I want to run code that will use this information automatically. How can I make sure this second piece of code will run after the jquery?
You will have to make an AJAX call up to the server.