I’ve been experimenting with a simple project that essentially just stores the number of visits to the sites, along with the latitude / longitude of the user (it’s mainly for people visiting via the iPhones Safari browser).
I’ve managed to store the ‘clicks’ to the page via PHP / MySQL, and I can display the users lat / long via the navigator.geolocation object in Javascript, but I have no idea how I can then store that (I’m fairly new at this!).
I appreciated that JavaScript is client-side and PHP is server-side, so I presume I need to somehow pass the returned values of my Javascript back to the PHP code somehow?
Thanks for any advice!
I’ve not used the
navigator.geolocationobject, but you should be able to send what it returns to an external page using AJAX.The above is an example written on top of the jQuery framework.