Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
jsMaps retrieve marker position

Edited this code to show map and draggable marker on it

    <script type='text/javascript'>

    jsMaps.loader(function (){
        var tiles = new jsMaps.Native.Tiles();
tiles.addTileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png",['a','b','c'],'','');

        var map = jsMaps.api.init(
                '#map',
                'native',
                {
                    center: {
                        latitude: <?php echo $lat;?>,
                        longitude: <?php echo $lon;?>
                    },
                    zoom: 17,
                    mouse_scroll: true,
                    zoom_control: true,
                    map_type: true
                },tiles
        );

      var marker1 =  jsMaps.api.marker(map,{position: {lat: <?php echo $lat;?>,lng: <?php echo $lon;?>}, title: 'Marker No 1',draggable: true});
        
        var contentString = '<div id="content">'+
                '<div id="siteNotice">'+
                '</div>'+
                '<h1 id="firstHeading" class="firstHeading">Drag to set good position</h1>'+
                '<div id="bodyContent">'+
                '<p>MyEasyMenu.cloud</p>'+
                '</div>'+
                '</div>';

        var infoWindow = jsMaps.api.infoWindow({content: contentString});
        
        jsMaps.api.attach_event(marker1,'mouseover',function() {
            infoWindow.open(map,marker1);
        });

        jsMaps.api.attach_event(marker1,'mouseout',function() {
            infoWindow.close();
        });
        
        jsMaps.api.attach_event(marker1,'dragend',function() {
            //var lngLat =   jsMaps.api.marker(map,{position{getPosition()});   
            document.getElementById("longitude").value = lngLat.lon;
            document.getElementById("latitude").value = lngLat.lat;
        });

    });
</script>

I need to retrieve the coordinate from draggable marker. How can update the lat/lon after dragend ? on API resource mentioned Method but I don't know how to update the var lngLat.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!