Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fetching coordinates from db to map




const options = {method: 'GET', headers: {Accept: 'application/json'}};
fetch('http://127.0.0.1:8000/api/readcp', options)
  .then(response => response.json())
  .then(response =>{

    response.forEach(n => {

        var N_array=n.longlat.split(",");

        NMArker=L.marker(N_array,{icon:myIcon});

        var popup=NMArker.bindPopup('This is' +   n.address + 'point' +  NMArker.getLatLng()).openPopup();
        popup.addTo(map);
    });
        console.log(response)})
  .catch(err => console.log(err));
 
PREVIOUS NEXT
Tagged: #fetching #coordinates #db #map
ADD COMMENT
Topic
Name
8+1 =