javascript - send html5 value to php


hi i have this code for geo location finding

    <p id="demo"></p>
        <script type="text/javascript">  function get_stored_data() {
alert(localStorage.value); }
var x = document.getElementById("demo");

function getLocation() {
    if (navigator.geolocation) {
    } else { 
        x.innerHTML = "Geolocation is not supported by this browser.";

function showPosition(position) {
    x.innerHTML = "Latitude: " + position.coords.latitude + 
    "<br>Longitude: " + position.coords.longitude;  

        <p>The element below will receive content</p>
        <div id="div" />
        <script type="text/javascript">getLocation()</script>

and i want to send the values of the latitude and longitude to php file that will write it in a text file




I use $_GET or $_POST methods to pass my data to another PHP page




You have to call ajax and send values. This link may be helpful

People are also looking for solutions to the problem: How to compare two character in php?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.